20 private readonly List<BadExpression>
m_Body;
51 public void SetBody(IEnumerable<BadExpression> body)
63 for (
int i = 0; i <
m_Body.Count; i++)
74 yield
return expression;
79 yield
return descendant;
89 StringBuilder sb =
new StringBuilder($
"while ({Condition})");
95 sb.AppendLine($
"\t{expression}");
100 return sb.ToString();
121 context.Scope.CreateChild(
136 if (loopContext.Scope.IsBreak || loopContext.Scope.ReturnValue !=
null)
Describes a specific position inside a source file.
Implements a simple constant folding optimization.
static BadExpression Optimize(BadExpression expr)
Optimizes the given expression.
Base Implementation for all Expressions used inside the Script.
IEnumerable< BadExpression > GetDescendantsAndSelf()
Returns all Descendants of the Expression and the Expression itself.
BadSourcePosition Position
The source Position of the Expression.
IEnumerable< BadObject > Execute(BadExecutionContext context)
Evaluates the Expression within the current Execution Context.
Implements the While Expression.
void SetBody(IEnumerable< BadExpression > body)
Sets the Body of the Loop.
override IEnumerable< BadObject > InnerExecute(BadExecutionContext context)
BadWhileExpression(BadExpression condition, List< BadExpression > block, BadSourcePosition position)
Constructor of the While Expression.
BadExpression Condition
The Loop Condition.
override string ToString()
Returns a human readable representation of the Expression.
override void Optimize()
Uses the Constant Folding Optimizer to optimize the expression.
override IEnumerable< BadExpression > GetDescendants()
readonly List< BadExpression > m_Body
The Loop Body.
IEnumerable< BadExpression > Body
The Loop Body.
The Execution Context. Every execution of a script needs a context the script is running in....
Gets thrown by the runtime.
The Base Class for all BadScript Objects.
static readonly BadObject Null
The Null Value for the BadScript Language.
Implements the Interface for Native Boolean.
new bool Value
The Boolean Value.
Contains Shared Data Structures and Functionality.
Contains the BadScript2 Constant Folding Optimizations.
Contains the Loop Expressions for the BadScript2 Language.
Contains the Error Objects for the BadScript2 Language.
Contains the Native Runtime Objects.
Contains the Runtime Objects.
Contains the Runtime Implementation.
BadScopeFlags
Defines Different Behaviours for the Current Scope.