예제 #1
0
        public MemberExpressionNode(IdentifierExpressionNode[] members)
        {
            if (members == null)
                ThrowHelper.ThrowArgumentNullException(() => members);

            Members = members;
            AddChildren(Members.Cast<Node>().ToArray());
        }
        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 VariableDeclarationStatementNode(string name, TypeNameNode variableType, ExpressionNode initialValue, AttributeNode[] attributes)
        {
            if (name == null)
                ThrowHelper.ThrowArgumentNullException(() => name);

            if (variableType == null)
                ThrowHelper.ThrowArgumentNullException(() => variableType);

            if (initialValue == null)
                ThrowHelper.ThrowArgumentNullException(() => initialValue);

            InitialValue = initialValue;
            Identifier = new IdentifierExpressionNode(name, null);
            VariableType = variableType;
            Attributes = attributes.ToList();

            AddChildren(Identifier, VariableType, InitialValue);
            AddChildren(Attributes);
        }