public static Expression Analyze(AnalysisContext analysisContext, StatementNodeBase node) { var analyzer = new StatementAnalyzer(analysisContext); node.Accept(analyzer); if(analyzer._result == null) throw new InternalException("StatementAnalyzer did not handle a " + node.GetType() + " which is a descendant of StatementNodeBase"); return analyzer._result; }
public WhileLoopStatementNode(ExpressionNode conditionExpression, StatementNodeBase body, AttributeNode[] attributes) : base(body, attributes) { if (conditionExpression == null) throw new ArgumentNullException("conditionExpression", "The ConditionExpression is null!"); ConditionExpression = conditionExpression; AddChildren(ConditionExpression); }
public Node PrependStatement(StatementNodeBase[] statements) { if (statements == null) throw new ArgumentNullException("statements"); InsertChildren(0, statements); Statements.InsertRange(0, statements); return this; }
public WhileLoopStatementNode While(ExpressionNode condition, StatementNodeBase body, AttributeNode[] attributes) { if (condition == null) ThrowHelper.ThrowArgumentNullException(() => condition); if (attributes == null) ThrowHelper.ThrowArgumentNullException(() => attributes); return new WhileLoopStatementNode(condition, body, attributes); }
protected LoopStatementNodeBase(StatementNodeBase body, IEnumerable<AttributeNode> attributes) { if (attributes == null) ThrowHelper.ThrowArgumentNullException(() => attributes); Body = body; Attributes = attributes.ToList(); AddChildren(Body); AddChildren(Attributes); }
public ForeachLoopStatementNode Foreach(string variable, TypeNameNode variableType, ExpressionNode expression, StatementNodeBase body, AttributeNode[] attributes) { if (string.IsNullOrWhiteSpace(variable)) ThrowHelper.ThrowException("The 'variable' is blank!"); if (expression == null) ThrowHelper.ThrowArgumentNullException(() => expression); if (body == null) ThrowHelper.ThrowArgumentNullException(() => body); if (attributes == null) ThrowHelper.ThrowArgumentNullException(() => attributes); return new ForeachLoopStatementNode(variable, variableType, expression, body, attributes); }
public ForeachLoopStatementNode(string variable, TypeNameNode variableType, ExpressionNode expression, StatementNodeBase body, AttributeNode[] attributes) : base(body, attributes) { if (string.IsNullOrWhiteSpace(variable)) ThrowHelper.ThrowException("The 'variable' is blank!"); if (expression == null) throw new ArgumentNullException("expression", "The expression is null!"); if (attributes == null) ThrowHelper.ThrowArgumentNullException(() => attributes); LoopVariable = new IdentifierExpressionNode(variable); Expression = expression; LoopVariableType = variableType; AddChildren(LoopVariable, LoopVariableType, Expression); }
public MacroCallExpressionNode MacroCall(string name, StatementNodeBase[] actualParameters) { if (string.IsNullOrWhiteSpace(name)) ThrowHelper.ThrowException("The 'name' is blank!"); if (actualParameters == null) ThrowHelper.ThrowArgumentNullException(() => actualParameters); return new MacroCallExpressionNode(name, actualParameters); }
public ForeachLoopStatementNode Foreach(string variable, TypeNameNode variableType, ExpressionNode expression, StatementNodeBase body) { return Foreach(variable, variableType, expression, body, new AttributeNode[0]); }
public BlockStatementNode Block(StatementNodeBase[] statements, AttributeNode[] attributes) { if (statements == null) throw new ArgumentNullException("statements"); if (attributes == null) ThrowHelper.ThrowArgumentNullException(() => attributes); return new BlockStatementNode(statements, attributes); }
public BlockStatementNode Block(StatementNodeBase[] statements) { return Block(statements, new AttributeNode[0]); }