public WhileStatement(Expression condition, Statement body, bool preCondition) : base(StatementType.While) { _condition = condition; _body = body; _preCondition = preCondition; }
public void AddCatch(VariableSymbol exceptionVariable, Statement catchStatement) { Debug.Assert(_exceptionVariable == null); Debug.Assert(_catch == null); _exceptionVariable = exceptionVariable; _catch = catchStatement; }
public IfElseStatement(Expression condition, Statement ifStatement, Statement elseStatement) : base(StatementType.IfElse) { _condition = condition; _ifStatement = ifStatement; _elseStatement = elseStatement; }
public static void GenerateStatement(ScriptGenerator generator, MemberSymbol symbol, Statement statement) { switch (statement.Type) { case StatementType.Block: GenerateBlockStatement(generator, symbol, (BlockStatement)statement); break; case StatementType.Empty: break; case StatementType.VariableDeclaration: GenerateVariableDeclarationStatement(generator, symbol, (VariableDeclarationStatement)statement); break; case StatementType.Return: GenerateReturnStatement(generator, symbol, (ReturnStatement)statement); break; case StatementType.Expression: GenerateExpressionStatement(generator, symbol, (ExpressionStatement)statement); break; case StatementType.IfElse: GenerateIfElseStatement(generator, symbol, (IfElseStatement)statement); break; case StatementType.While: GenerateWhileStatement(generator, symbol, (WhileStatement)statement); break; case StatementType.For: GenerateForStatement(generator, symbol, (ForStatement)statement); break; case StatementType.ForIn: GenerateForInStatement(generator, symbol, (ForInStatement)statement); break; case StatementType.Switch: GenerateSwitchStatement(generator, symbol, (SwitchStatement)statement); break; case StatementType.Break: GenerateBreakStatement(generator, symbol, (BreakStatement)statement); break; case StatementType.Continue: GenerateContinueStatement(generator, symbol, (ContinueStatement)statement); break; case StatementType.Throw: GenerateThrowStatement(generator, symbol, (ThrowStatement)statement); break; case StatementType.TryCatchFinally: GenerateTryCatchFinallyStatement(generator, symbol, (TryCatchFinallyStatement)statement); break; case StatementType.Error: GenerateErrorStatement(generator, symbol, (ErrorStatement)statement); break; default: Debug.Fail("Unexpected statement type: " + statement.Type); break; } }
public void AddStatement(Statement statement) { _statements.Add(statement); }
public void AddBody(Statement statement) { Debug.Assert(_body == null); _body = statement; }
public void AddFinally(Statement finallyStatement) { Debug.Assert(_finally == null); _finally = finallyStatement; }