示例#1
0
        /// <summary>
        /// Initializes a new instance of the CodeUnitProxy class.
        /// </summary>
        /// <param name="document">The parent document.</param>
        public CodeUnitProxy(CsDocument document)
        {
            Param.Ignore(document);

            this.document = document;
            this.children = new CodeUnitCollection(this);
        }
 internal QueryContinuationClause(CsTokenList tokens, Microsoft.StyleCop.CSharp.Variable variable, ICollection<QueryClause> clauses)
     : base(QueryClauseType.Continuation, tokens)
 {
     this.variable = variable;
     this.clauses = new CodeUnitCollection<QueryClause>(this);
     this.clauses.AddRange(clauses);
 }
 internal QueryExpression(CsTokenList tokens, ICollection<QueryClause> clauses)
     : base(ExpressionType.Query, tokens)
 {
     this.clauses = new CodeUnitCollection<QueryClause>(this);
     this.clauses.AddRange(clauses);
     this.InitializeFromClauses(clauses);
 }
        /// <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.");
        }
        /// <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);
        }
示例#7
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);
        }
示例#8
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);
        }
示例#9
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);
        }
示例#10
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);
        }
示例#11
0
 internal void AddStatements(IEnumerable<Statement> items)
 {
     if (this.statements == null)
     {
         this.statements = new CodeUnitCollection<Statement>(this);
     }
     this.statements.AddRange(items);
 }
示例#12
0
 internal void AddStatement(Statement statement)
 {
     if (this.statements == null)
     {
         this.statements = new CodeUnitCollection<Statement>(this);
     }
     this.statements.Add(statement);
 }
示例#13
0
 internal void AddExpressions(IEnumerable<Expression> items)
 {
     if (this.expressions == null)
     {
         this.expressions = new CodeUnitCollection<Expression>(this);
     }
     this.expressions.AddRange(items);
 }
示例#14
0
 internal void AddExpression(Expression expression)
 {
     if (this.expressions == null)
     {
         this.expressions = new CodeUnitCollection<Expression>(this);
     }
     this.expressions.Add(expression);
 }