예제 #1
0
        /// <summary>
        /// Adds a range of child statements.
        /// </summary>
        /// <param name="items">
        /// The statements to add.
        /// </param>
        internal void AddStatements(IEnumerable <Statement> items)
        {
            Param.AssertNotNull(items, "items");

            if (this.statements == null)
            {
                this.statements = new CodeUnitCollection <Statement>(this);
            }

            this.statements.AddRange(items);
        }
예제 #2
0
        /// <summary>
        /// Adds a child element to this element.
        /// </summary>
        /// <param name="element">
        /// The child element to add.
        /// </param>
        internal virtual void AddElement(CsElement element)
        {
            Param.AssertNotNull(element, "element");

            if (this.elements == null)
            {
                this.elements = new CodeUnitCollection <CsElement>(this);
            }

            this.elements.Add(element);
        }
예제 #3
0
        /// <summary>
        /// Adds a child statement.
        /// </summary>
        /// <param name="statement">
        /// The statement to add.
        /// </param>
        internal void AddStatement(Statement statement)
        {
            Param.AssertNotNull(statement, "statement");

            if (this.statements == null)
            {
                this.statements = new CodeUnitCollection <Statement>(this);
            }

            this.statements.Add(statement);
        }
예제 #4
0
        /// <summary>
        /// Adds a range of child expressions.
        /// </summary>
        /// <param name="items">
        /// The expressions to add.
        /// </param>
        internal void AddExpressions(IEnumerable <Expression> items)
        {
            Param.AssertNotNull(items, "items");

            if (this.expressions == null)
            {
                this.expressions = new CodeUnitCollection <Expression>(this);
            }

            this.expressions.AddRange(items);
        }
예제 #5
0
        /// <summary>
        /// Adds a child expression.
        /// </summary>
        /// <param name="expression">
        /// The expression to add.
        /// </param>
        internal void AddExpression(Expression expression)
        {
            Param.AssertNotNull(expression, "expression");

            if (this.expressions == null)
            {
                this.expressions = new CodeUnitCollection <Expression>(this);
            }

            this.expressions.Add(expression);
        }
예제 #6
0
        /// <summary>
        /// Initializes a new instance of the QueryExpression class.
        /// </summary>
        /// <param name="tokens">
        /// The list of tokens that form the expression.
        /// </param>
        /// <param name="clauses">
        /// The collection of clauses in the expression.
        /// </param>
        internal QueryExpression(CsTokenList tokens, ICollection <QueryClause> clauses)
            : base(ExpressionType.Query, tokens)
        {
            Param.AssertNotNull(tokens, "tokens");
            Param.AssertNotNull(clauses, "clauses");

            this.clauses = new CodeUnitCollection <QueryClause>(this);
            this.clauses.AddRange(clauses);
            this.InitializeFromClauses(clauses);

            Debug.Assert(clauses.IsReadOnly, "The collection of query clauses should be read-only.");
        }
        /// <summary>
        /// Initializes a new instance of the QueryContinuationClause class.
        /// </summary>
        /// <param name="tokens">
        /// The list of tokens that form the clause.
        /// </param>
        /// <param name="variable">
        /// The continuation clause variable.
        /// </param>
        /// <param name="clauses">
        /// The collection of clauses in the expression.
        /// </param>
        internal QueryContinuationClause(CsTokenList tokens, Variable variable, ICollection <QueryClause> clauses)
            : base(QueryClauseType.Continuation, tokens)
        {
            Param.AssertNotNull(tokens, "tokens");
            Param.AssertNotNull(clauses, "clauses");
            Param.AssertNotNull(variable, "variable");

            this.variable = variable;
            this.clauses  = new CodeUnitCollection <QueryClause>(this);
            this.clauses.AddRange(clauses);

            Debug.Assert(clauses.IsReadOnly, "The collection of query clauses should be read-only.");
        }
예제 #8
0
        /// <summary>
        /// Initializes a new instance of the Attribute class.
        /// </summary>
        /// <param name="childTokens">
        /// The list of child tokens for the attribute.
        /// </param>
        /// <param name="location">
        /// The location of the attribute.
        /// </param>
        /// <param name="parent">
        /// The parent of the attribute.
        /// </param>
        /// <param name="attributeExpressions">
        /// The list of attribute expressions within this attribute.
        /// </param>
        /// <param name="generated">
        /// Indicates whether the attribute resides within a block of generated code.
        /// </param>
        internal Attribute(
            MasterList <CsToken> childTokens, CodeLocation location, Reference <ICodePart> parent, IEnumerable <AttributeExpression> attributeExpressions, bool generated)
            : base(CsTokenType.Attribute, CsTokenClass.Attribute, location, parent, generated)
        {
            Param.AssertNotNull(childTokens, "childTokens");
            Param.AssertGreaterThanOrEqualTo(childTokens.Count, 2, "childTokens");
            Param.AssertNotNull(location, "location");
            Param.AssertNotNull(parent, "parent");
            Param.AssertNotNull(attributeExpressions, "attributeExpressions");
            Param.Ignore(generated);

            this.childTokens = childTokens;

            this.attributeExpressions = new CodeUnitCollection <AttributeExpression>(this);
            this.attributeExpressions.AddRange(attributeExpressions);
        }