public WhileAction(ParseInfo parseInfo, Scope scope, While whileContext) { RawContinue = true; Condition = parseInfo.GetExpression(scope, whileContext.Condition); TypeComparison.ExpectNonConstant(parseInfo, whileContext.Condition.Range, Condition.Type()); Block = parseInfo.SetLoop(this).GetStatement(scope, whileContext.Statement); Path = new PathInfo(Block, whileContext.Range, false); }
public ElseIfAction(ParseInfo parseInfo, Scope scope, ElseIf elseIfContext) { // Get the else-if's expression. Expression = parseInfo.GetExpression(scope, elseIfContext.Expression); TypeComparison.ExpectNonConstant(parseInfo, elseIfContext.Expression.Range, Expression.Type()); // Get the else-if's block. Block = parseInfo.GetStatement(scope, elseIfContext.Statement); }
public IfAction(ParseInfo parseInfo, Scope scope, If ifContext) { // Get the if condition. Expression = parseInfo.GetExpression(scope, ifContext.Expression); TypeComparison.ExpectNonConstant(parseInfo, ifContext.Expression.Range, Expression.Type()); // Contains the path info of all blocks in the if/else-if/else list. var paths = new List <PathInfo>(); // Get the if's block. Block = parseInfo.GetStatement(scope, ifContext.Statement); // Add the if block path info. paths.Add(new PathInfo(Block, ifContext.Range, false)); // Get the else-ifs. ElseIfs = new ElseIfAction[ifContext.ElseIfs.Count]; for (int i = 0; i < ElseIfs.Length; i++) { ElseIfs[i] = new ElseIfAction(parseInfo, scope, ifContext.ElseIfs[i]); paths.Add(new PathInfo(Block, ifContext.Range, false)); } // If there is an else statement, get the else block. if (ifContext.Else != null) { ElseBlock = parseInfo.GetStatement(scope, ifContext.Else.Statement); // Add the else path info. paths.Add(new PathInfo(ElseBlock, ifContext.Range, true)); } Paths = paths.ToArray(); if (Block is BlockAction block) { EndComment = block.EndComment; } }