示例#1
0
 /// <summary>
 /// Initializes a new instance of the Interface class.
 /// </summary>
 /// <param name="proxy">Proxy object for the interface.</param>
 /// <param name="name">The name of the interface.</param>
 /// <param name="attributes">The list of attributes attached to this element.</param>
 /// <param name="typeConstraints">The list of type constraints on the class, if any.</param>
 /// <param name="unsafeCode">Indicates whether the element resides within a block of unsafe code.</param>
 internal Interface(CodeUnitProxy proxy, string name, ICollection<Attribute> attributes, ICollection<TypeParameterConstraintClause> typeConstraints, bool unsafeCode)
     : base(proxy, ElementType.Interface, name, attributes, typeConstraints, unsafeCode)
 {
     Param.AssertNotNull(proxy, "proxy");
     Param.AssertValidString(name, "name");
     Param.Ignore(attributes, typeConstraints, unsafeCode);
 }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the Expression class.
 /// </summary>
 /// <param name="proxy">Proxy object for the expression.</param>
 /// <param name="type">The type of the expression.</param>
 internal Expression(CodeUnitProxy proxy, int type)
     : base(proxy, type)
 {
     Param.AssertNotNull(proxy, "proxy");
     Param.Ignore(type);
     CsLanguageService.Debug.Assert(System.Enum.IsDefined(typeof(ExpressionType), this.ExpressionType), "The type is invalid.");
 }
示例#3
0
        /// <summary>
        /// Reads a NOT expression.
        /// </summary>
        /// <param name="parentProxy">Represents the parent item.</param>
        /// <returns>Returns the expression.</returns>
        private UnaryExpression GetConditionalPreprocessorNotExpression(CodeUnitProxy parentProxy)
        {
            Param.AssertNotNull(parentProxy, "parentProxy");

            this.AdvanceToNextConditionalDirectiveCodeSymbol(parentProxy);
            var expressionProxy = new CodeUnitProxy(this.document);

            Symbol symbol = this.symbols.Peek(1);

            CsLanguageService.Debug.Assert(symbol != null, "The next symbol should not be null");

            // Create the token based on the type of the symbol.
            var token = new NotOperator(this.document, symbol.Text, symbol.Location, this.symbols.Generated);

            expressionProxy.Children.Add(token);

            // Advance up to the symbol and add it to the document.
            this.symbols.Advance();

            // Get the expression after the operator.
            Expression expression = this.GetNextConditionalPreprocessorExpression(this.document, expressionProxy, ExpressionPrecedence.Unary);

            if (expression == null || expression.Children.Count == 0)
            {
                throw new SyntaxException(this.document, symbol.LineNumber);
            }

            // Create and return the expression.
            var unaryExpression = new NotExpression(expressionProxy, expression);

            parentProxy.Children.Add(unaryExpression);

            return(unaryExpression);
        }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the Enum class.
 /// </summary>
 /// <param name="proxy">Proxy object for the enum.</param>
 /// <param name="name">The name of the enum.</param>
 /// <param name="attributes">The list of attributes attached to this element.</param>
 /// <param name="unsafeCode">Indicates whether the element resides within a block of unsafe code.</param>
 internal Enum(CodeUnitProxy proxy, string name, ICollection<Attribute> attributes, bool unsafeCode)
     : base(proxy, ElementType.Enum, name, attributes, unsafeCode)
 {
     Param.AssertNotNull(proxy, "proxy");
     Param.AssertValidString(name, "name");
     Param.Ignore(attributes, unsafeCode);
 }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the Statement class.
 /// </summary>
 /// <param name="proxy">Proxy object for the statement.</param>
 /// <param name="type">The type of the statement.</param>
 internal Statement(CodeUnitProxy proxy, StatementType type) 
     : base(proxy, (int)type)
 {
     Param.AssertNotNull(proxy, "proxy");
     Param.Ignore(type);
     CsLanguageService.Debug.Assert(System.Enum.IsDefined(typeof(StatementType), this.StatementType), "The type is invalid.");
 }
示例#6
0
文件: Struct.cs 项目: sarvex/StyleCop
 /// <summary>
 /// Initializes a new instance of the Struct class.
 /// </summary>
 /// <param name="proxy">Proxy object for the struct.</param>
 /// <param name="name">The name of the struct.</param>
 /// <param name="attributes">The list of attributes attached to this element.</param>
 /// <param name="typeConstraints">The list of type constraints on the class, if any.</param>
 /// <param name="unsafeCode">Indicates whether the element resides within a block of unsafe code.</param>
 internal Struct(CodeUnitProxy proxy, string name, ICollection <Attribute> attributes, ICollection <TypeParameterConstraintClause> typeConstraints, bool unsafeCode)
     : base(proxy, ElementType.Struct, name, attributes, typeConstraints, unsafeCode)
 {
     Param.AssertNotNull(proxy, "proxy");
     Param.AssertValidString(name, "name");
     Param.Ignore(attributes, typeConstraints, unsafeCode);
 }
示例#7
0
        /// <summary>
        /// Reads an expression starting with an unknown word.
        /// </summary>
        /// <param name="parentProxy">Proxy object for the parent item.</param>
        /// <returns>Returns the expression.</returns>
        private LiteralExpression GetConditionalPreprocessorConstantExpression(CodeUnitProxy parentProxy)
        {
            Param.AssertNotNull(parentProxy, "parentProxy");

            this.AdvanceToNextConditionalDirectiveCodeSymbol(parentProxy);
            var expressionProxy = new CodeUnitProxy(this.document);

            // Get the first symbol.
            Symbol symbol = this.symbols.Peek(1);

            CsLanguageService.Debug.Assert(symbol != null && symbol.SymbolType == SymbolType.Other, "Expected a text symbol");

            // Convert the symbol to a token.
            this.symbols.Advance();

            var literalToken = new LiteralToken(this.document, symbol.Text, symbol.Location, this.symbols.Generated);

            expressionProxy.Children.Add(literalToken);

            // Create a literal expression from this token.
            var literalExpression = new LiteralExpression(expressionProxy, literalToken);

            parentProxy.Children.Add(literalExpression);

            return(literalExpression);
        }
示例#8
0
        /// <summary>
        /// Initializes a new instance of the GenericTypeToken class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        internal GenericTypeToken(CodeUnitProxy proxy)
            : base(proxy)
        {
            Param.AssertGreaterThanOrEqualTo(proxy.Children.Count, 3, "childTokens");

            this.IsGeneric = true;
        }
示例#9
0
 /// <summary>
 /// Initializes a new instance of the Expression class.
 /// </summary>
 /// <param name="proxy">Proxy object for the expression.</param>
 /// <param name="type">The type of the expression.</param>
 internal Expression(CodeUnitProxy proxy, int type)
     : base(proxy, type)
 {
     Param.AssertNotNull(proxy, "proxy");
     Param.Ignore(type);
     CsLanguageService.Debug.Assert(System.Enum.IsDefined(typeof(ExpressionType), this.ExpressionType), "The type is invalid.");
 }
示例#10
0
文件: Enum.cs 项目: sarvex/StyleCop
 /// <summary>
 /// Initializes a new instance of the Enum class.
 /// </summary>
 /// <param name="proxy">Proxy object for the enum.</param>
 /// <param name="name">The name of the enum.</param>
 /// <param name="attributes">The list of attributes attached to this element.</param>
 /// <param name="unsafeCode">Indicates whether the element resides within a block of unsafe code.</param>
 internal Enum(CodeUnitProxy proxy, string name, ICollection <Attribute> attributes, bool unsafeCode)
     : base(proxy, ElementType.Enum, name, attributes, unsafeCode)
 {
     Param.AssertNotNull(proxy, "proxy");
     Param.AssertValidString(name, "name");
     Param.Ignore(attributes, unsafeCode);
 }
示例#11
0
        /// <summary>
        /// Initializes a new instance of the GenericTypeToken class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        internal GenericTypeToken(CodeUnitProxy proxy)
            : base(proxy)
        {
            Param.AssertGreaterThanOrEqualTo(proxy.Children.Count, 3, "childTokens");

            this.IsGeneric = true;
        }
示例#12
0
 /// <summary>
 /// Initializes a new instance of the QueryClause class.
 /// </summary>
 /// <param name="proxy">Proxy object for the query clause.</param>
 /// <param name="type">The type of the clause.</param>
 internal QueryClause(CodeUnitProxy proxy, QueryClauseType type)
     : base(proxy, (int)type)
 {
     Param.AssertNotNull(proxy, "proxy");
     Param.Ignore(type);
     CsLanguageService.Debug.Assert(System.Enum.IsDefined(typeof(QueryClauseType), this.QueryClauseType), "The type is invalid.");
 }
示例#13
0
        /// <summary>
        /// Initializes a new instance of the Element class.
        /// </summary>
        /// <param name="proxy">Proxy object for the element.</param>
        /// <param name="type">The element type.</param>
        /// <param name="name">The name of this element.</param>
        /// <param name="attributes">The list of attributes attached to this element.</param>
        /// <param name="unsafeCode">Indicates whether the element is unsafe.</param>
        internal Element(
            CodeUnitProxy proxy,
            int type,
            string name,
            ICollection <Attribute> attributes,
            bool unsafeCode)
            : base(proxy, (int)type)
        {
            Param.Ignore(proxy);
            Param.Ignore(type);
            Param.AssertNotNull(name, "name");
            Param.Ignore(attributes);
            Param.Ignore(unsafeCode);

            CsLanguageService.Debug.Assert(System.Enum.IsDefined(typeof(ElementType), this.ElementType), "The type is invalid.");

            this.name.Value       = name;
            this.attributes.Value = attributes ?? Attribute.EmptyAttributeArray;
            CsLanguageService.Debug.Assert(attributes == null || attributes.IsReadOnly, "The attributes collection should be read-only");

            this.unsafeCode.Value = unsafeCode;
            if (!unsafeCode && this.ContainsModifier(TokenType.Unsafe))
            {
                this.unsafeCode.Value = true;
            }
        }
示例#14
0
        /// <summary>
        /// Initializes a new instance of the FixedStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="fixedVariable">The fixed variable.</param>
        internal FixedStatement(CodeUnitProxy proxy, VariableDeclarationExpression fixedVariable)
            : base(proxy, StatementType.Fixed)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(fixedVariable, "fixedVariable");

            this.fixedVariable.Value = fixedVariable;
        }
示例#15
0
        /// <summary>
        /// Initializes a new instance of the CheckedExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="internalExpression">The expression wrapped within the checked expression.</param>
        internal CheckedExpression(CodeUnitProxy proxy, Expression internalExpression)
            : base(proxy, ExpressionType.Checked)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(internalExpression, "internalExpression");

            this.internalExpression.Value = internalExpression;
        }
示例#16
0
        /// <summary>
        /// Initializes a new instance of the LiteralExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="token">The literal token.</param>
        internal LiteralExpression(CodeUnitProxy proxy, Token token)
            : base(proxy, ExpressionType.Literal)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(token, "token");

            this.token.Value = token;
        }
示例#17
0
        /// <summary>
        /// Initializes a new instance of the SwitchCaseStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="identifier">The case label identifier.</param>
        internal SwitchCaseStatement(CodeUnitProxy proxy, Expression identifier)
            : base(proxy, StatementType.SwitchCase)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(identifier, "identifier");

            this.identifier.Value = identifier;
        }
示例#18
0
        /// <summary>
        /// Initializes a new instance of the LockStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="lockedExpression">The item to lock.</param>
        internal LockStatement(CodeUnitProxy proxy, Expression lockedExpression)
            : base(proxy, StatementType.Lock)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(lockedExpression, "lockedExpression");

            this.lockObject.Value = lockedExpression;
        }
示例#19
0
        /// <summary>
        /// Initializes a new instance of the ArgumentList class.
        /// </summary>
        /// <param name="proxy">The proxy class.</param>
        /// <param name="arguments">The collection of arguments within the list.</param>
        internal ArgumentList(CodeUnitProxy proxy, IEnumerable<Argument> arguments)
            : base(proxy, CodeUnitType.ArgumentList)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(arguments, "arguments");

            this.arguments.Value = new List<Argument>(arguments);
        }
示例#20
0
        /// <summary>
        /// Initializes a new instance of the StackallocExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="type">The array type.</param>
        internal StackallocExpression(CodeUnitProxy proxy, ArrayAccessExpression type)
            : base(proxy, ExpressionType.Stackalloc)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(type, "type");

            this.type.Value = type;
        }
        /// <summary>
        /// Initializes a new instance of the StackallocExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="type">The array type.</param>
        internal StackallocExpression(CodeUnitProxy proxy, ArrayAccessExpression type)
            : base(proxy, ExpressionType.Stackalloc)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(type, "type");

            this.type.Value = type;
        }
示例#22
0
        /// <summary>
        /// Initializes a new instance of the LockStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="lockedExpression">The item to lock.</param>
        internal LockStatement(CodeUnitProxy proxy, Expression lockedExpression)
            : base(proxy, StatementType.Lock)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(lockedExpression, "lockedExpression");

            this.lockObject.Value = lockedExpression;
        }
示例#23
0
        /// <summary>
        /// Initializes a new instance of the ReturnStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="returnValue">The return value expression, if there is one.</param>
        internal ReturnStatement(CodeUnitProxy proxy, Expression returnValue)
            : base(proxy, StatementType.Return)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.Ignore(returnValue);

            this.returnValue.Value = returnValue;
        }
示例#24
0
        /// <summary>
        /// Initializes a new instance of the DefaultValueExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="type">The type to obtain the default value of.</param>
        internal DefaultValueExpression(CodeUnitProxy proxy, LiteralExpression type)
            : base(proxy, ExpressionType.DefaultValue)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(type, "type");

            this.type.Value = CodeParser.ExtractTypeTokenFromLiteralExpression(type);
        }
示例#25
0
        /// <summary>
        /// Initializes a new instance of the CheckedExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="internalExpression">The expression wrapped within the checked expression.</param>
        internal CheckedExpression(CodeUnitProxy proxy, Expression internalExpression)
            : base(proxy, ExpressionType.Checked)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(internalExpression, "internalExpression");

            this.internalExpression.Value = internalExpression;
        }
示例#26
0
        /// <summary>
        /// Initializes a new instance of the LabelStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="identifier">The label identifier.</param>
        internal LabelStatement(CodeUnitProxy proxy, LiteralExpression identifier)
            : base(proxy, StatementType.Label)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(identifier, "identifier");

            this.identifier.Value = identifier;
        }
示例#27
0
        /// <summary>
        /// Initializes a new instance of the VariableDeclarationStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="expression">The inner expression.</param>
        internal VariableDeclarationStatement(CodeUnitProxy proxy, VariableDeclarationExpression expression)
            : base(proxy, StatementType.VariableDeclaration)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(expression, "expression");

            this.expression.Value = expression;
        }
示例#28
0
        /// <summary>
        /// Initializes a new instance of the LabelStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="identifier">The label identifier.</param>
        internal LabelStatement(CodeUnitProxy proxy, LiteralExpression identifier)
            : base(proxy, StatementType.Label)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(identifier, "identifier");

            this.identifier.Value = identifier;
        }
示例#29
0
        /// <summary>
        /// Initializes a new instance of the UnsafeStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="body">The body of the try-statement.</param>
        internal UnsafeStatement(CodeUnitProxy proxy, BlockStatement body)
            : base(proxy, StatementType.Unsafe)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(body, "body");

            this.body.Value = body;
        }
        /// <summary>
        /// Initializes a new instance of the VariableDeclarationStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="expression">The inner expression.</param>
        internal VariableDeclarationStatement(CodeUnitProxy proxy, VariableDeclarationExpression expression)
            : base(proxy, StatementType.VariableDeclaration)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(expression, "expression");

            this.expression.Value = expression;
        }
示例#31
0
        /// <summary>
        /// Initializes a new instance of the IfStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="condition">The expression within the if-statement.</param>
        internal IfStatement(CodeUnitProxy proxy, Expression condition)
            : base(proxy, StatementType.If)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(condition, "condition");

            this.condition.Value = condition;
        }
示例#32
0
        /// <summary>
        /// Initializes a new instance of the ComplexToken class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="tokenType">The type of the token.</param>
        internal ComplexToken(CodeUnitProxy proxy, TokenType tokenType)
            : base(proxy, tokenType)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.Ignore(tokenType);

            this.IsComplexToken = true;
        }
        /// <summary>
        /// Initializes a new instance of the PreprocessorDirective class.
        /// </summary>
        /// <param name="proxy">Proxy object for the directive.</param>
        /// <param name="preprocessorType">The type of the preprocessor.</param>
        internal PreprocessorDirective(CodeUnitProxy proxy, PreprocessorType preprocessorType)
            : base(proxy, (int)preprocessorType)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.Ignore(preprocessorType);

            CsLanguageService.Debug.Assert(System.Enum.IsDefined(typeof(PreprocessorType), this.PreprocessorType), "The type is invalid.");
        }
示例#34
0
        /// <summary>
        /// Initializes a new instance of the PreprocessorDirective class.
        /// </summary>
        /// <param name="proxy">Proxy object for the directive.</param>
        /// <param name="preprocessorType">The type of the preprocessor.</param>
        internal PreprocessorDirective(CodeUnitProxy proxy, PreprocessorType preprocessorType)
            : base(proxy, (int)preprocessorType)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.Ignore(preprocessorType);

            CsLanguageService.Debug.Assert(System.Enum.IsDefined(typeof(PreprocessorType), this.PreprocessorType), "The type is invalid.");
        }
示例#35
0
        /// <summary>
        /// Initializes a new instance of the ThrowStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="thrownExpression">The expression being thrown, if any.</param>
        internal ThrowStatement(CodeUnitProxy proxy, Expression thrownExpression)
            : base(proxy, StatementType.Throw)
        {
            Param.Ignore(proxy);
            Param.Ignore(thrownExpression);

            this.thrownExpression.Value = thrownExpression;
        }
示例#36
0
        /// <summary>
        /// Initializes a new instance of the UsingStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="resource">The resource aquisition expression declared in the using statement.</param>
        internal UsingStatement(CodeUnitProxy proxy, Expression resource)
            : base(proxy, StatementType.Using)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(resource, "resource");

            this.resource.Value = resource;
        }
示例#37
0
        /// <summary>
        /// Initializes a new instance of the ParenthesizedExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="innerExpression">The expression within the parenthesis.</param>
        internal ParenthesizedExpression(CodeUnitProxy proxy, Expression innerExpression)
            : base(proxy, ExpressionType.Parenthesized)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(innerExpression, "innerExpression");

            this.innerExpression.Value = innerExpression;
        }
示例#38
0
        /// <summary>
        /// Initializes a new instance of the LexicalElement class.
        /// </summary>
        /// <param name="proxy">The proxy for the element.</param>
        /// <param name="lexicalElementType">The lexical element type.</param>
        internal LexicalElement(CodeUnitProxy proxy, int lexicalElementType)
            : base(proxy, (int)lexicalElementType)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.Ignore(lexicalElementType);

            CsLanguageService.Debug.Assert(System.Enum.IsDefined(typeof(LexicalElementType), this.LexicalElementType), "The type is invalid.");
        }
示例#39
0
        /// <summary>
        /// Initializes a new instance of the ReturnStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="returnValue">The return value expression, if there is one.</param>
        internal ReturnStatement(CodeUnitProxy proxy, Expression returnValue)
            : base(proxy, StatementType.Return)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.Ignore(returnValue);

            this.returnValue.Value = returnValue;
        }
示例#40
0
        /// <summary>
        /// Initializes a new instance of the SizeofExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="type">The type to get the size of.</param>
        internal SizeofExpression(CodeUnitProxy proxy, Expression type)
            : base(proxy, ExpressionType.Sizeof)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(type, "type");

            this.type.Value = type;
        }
示例#41
0
        /// <summary>
        /// Initializes a new instance of the QuerySelectClause class.
        /// </summary>
        /// <param name="proxy">Proxy object for the clause.</param>
        /// <param name="expression">The expression.</param>
        internal QuerySelectClause(CodeUnitProxy proxy, Expression expression)
            : base(proxy, QueryClauseType.Select)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(expression, "expression");

            this.expression.Value = expression;
        }
示例#42
0
        /// <summary>
        /// Initializes a new instance of the UsingStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="resource">The resource aquisition expression declared in the using statement.</param>
        internal UsingStatement(CodeUnitProxy proxy, Expression resource)
            : base(proxy, StatementType.Using)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(resource, "resource");

            this.resource.Value = resource;
        }
示例#43
0
        /// <summary>
        /// Initializes a new instance of the FixedStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="fixedVariable">The fixed variable.</param>
        internal FixedStatement(CodeUnitProxy proxy, VariableDeclarationExpression fixedVariable)
            : base(proxy, StatementType.Fixed)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(fixedVariable, "fixedVariable");

            this.fixedVariable.Value = fixedVariable;
        }
        /// <summary>
        /// Initializes a new instance of the ConstructorInitializerStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="expression">The expression within this statement.</param>
        internal ConstructorInitializerStatement(CodeUnitProxy proxy, MethodInvocationExpression expression)
            : base(proxy, StatementType.ConstructorInitializer)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(expression, "expression");

            this.expression.Value = expression;
        }
示例#45
0
        /// <summary>
        /// Initializes a new instance of the ArrayAccessExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="array">Represents the item being indexed.</param>
        internal ArrayAccessExpression(CodeUnitProxy proxy, Expression array)
            : base(proxy, ExpressionType.ArrayAccess)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(array, "array");

            this.array.Value = array;
        }
示例#46
0
        /// <summary>
        /// Initializes a new instance of the UncheckedStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="body">The body of the unchecked statement, if any.</param>
        internal UncheckedStatement(CodeUnitProxy proxy, BlockStatement body)
            : base(proxy, StatementType.Unchecked)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(body, "body");

            this.body.Value = body;
        }
示例#47
0
        /// <summary>
        /// Initializes a new instance of the SizeofExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="type">The type to get the size of.</param>
        internal SizeofExpression(CodeUnitProxy proxy, Expression type)
            : base(proxy, ExpressionType.Sizeof)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(type, "type");

            this.type.Value = type;
        }
        /// <summary>
        /// Initializes a new instance of the ParenthesizedExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="innerExpression">The expression within the parenthesis.</param>
        internal ParenthesizedExpression(CodeUnitProxy proxy, Expression innerExpression)
            : base(proxy, ExpressionType.Parenthesized)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(innerExpression, "innerExpression");

            this.innerExpression.Value = innerExpression;
        }
示例#49
0
        /// <summary>
        /// Initializes a new instance of the ThrowStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="thrownExpression">The expression being thrown, if any.</param>
        internal ThrowStatement(CodeUnitProxy proxy, Expression thrownExpression)
            : base(proxy, StatementType.Throw)
        {
            Param.Ignore(proxy);
            Param.Ignore(thrownExpression);

            this.thrownExpression.Value = thrownExpression;
        }
示例#50
0
        /// <summary>
        /// Initializes a new instance of the LiteralExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="token">The literal token.</param>
        internal LiteralExpression(CodeUnitProxy proxy, Token token)
            : base(proxy, ExpressionType.Literal)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(token, "token");

            this.token.Value = token;
        }
示例#51
0
        /// <summary>
        /// Initializes a new instance of the QueryWhereClause class.
        /// </summary>
        /// <param name="proxy">Proxy object for the clause.</param>
        /// <param name="expression">The expression.</param>
        internal QueryWhereClause(CodeUnitProxy proxy, Expression expression)
            : base(proxy, QueryClauseType.Where)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(expression, "expression");

            this.expression.Value = expression;
        }
示例#52
0
        /// <summary>
        /// Initializes a new instance of the WhileStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="condition">The expression within the while-statement.</param>
        internal WhileStatement(CodeUnitProxy proxy, Expression condition)
            : base(proxy, StatementType.While)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(condition, "condition");

            this.condition.Value = condition;
        }
示例#53
0
        /// <summary>
        /// Initializes a new instance of the TypeofExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="type">The type literal to get the type of.</param>
        internal TypeofExpression(CodeUnitProxy proxy, LiteralExpression type)
            : base(proxy, ExpressionType.Typeof)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(type, "type");

            this.type.Value = CodeParser.ExtractTypeTokenFromLiteralExpression(type);
        }
示例#54
0
        /// <summary>
        /// Initializes a new instance of the ComplexToken class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="tokenType">The type of the token.</param>
        internal ComplexToken(CodeUnitProxy proxy, TokenType tokenType)
            : base(proxy, tokenType)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.Ignore(tokenType);

            this.IsComplexToken = true;
        }
        /// <summary>
        /// Initializes a new instance of the ArrayAccessExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="array">Represents the item being indexed.</param>
        internal ArrayAccessExpression(CodeUnitProxy proxy, Expression array)
            : base(proxy, ExpressionType.ArrayAccess)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(array, "array");

            this.array.Value = array;
        }
示例#56
0
        /// <summary>
        /// Initializes a new instance of the ElseStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="condition">The expression within the if portion of this 
        /// else-statement, if any.</param>
        internal ElseStatement(CodeUnitProxy proxy, Expression condition)
            : base(proxy, StatementType.Else)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.Ignore(condition);

            this.condition.Value = condition;
        }
        /// <summary>
        /// Initializes a new instance of the MethodInvocationExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="name">The name of the method.</param>
        internal MethodInvocationExpression(CodeUnitProxy proxy, Expression name)
            : base(proxy, ExpressionType.MethodInvocation)
        {
            Param.Ignore(proxy);
            Param.AssertNotNull(name, "name");

            this.name.Value = name;
        }
示例#58
0
        /// <summary>
        /// Initializes a new instance of the SwitchCaseStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="identifier">The case label identifier.</param>
        internal SwitchCaseStatement(CodeUnitProxy proxy, Expression identifier) 
            : base(proxy, StatementType.SwitchCase)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(identifier, "identifier");

            this.identifier.Value = identifier;
        }
示例#59
0
        /// <summary>
        /// Initializes a new instance of the EnumItem class.
        /// </summary>
        /// <param name="proxy">Proxy object for the enum.</param>
        /// <param name="name">The name of the enum.</param>
        /// <param name="attributes">The list of attributes attached to this element.</param>
        /// <param name="initialization">The initialization expression, if there is one.</param>
        /// <param name="unsafeCode">Indicates whether the element resides within a block of unsafe code.</param>
        internal EnumItem(CodeUnitProxy proxy, string name, ICollection<Attribute> attributes, Expression initialization, bool unsafeCode)
            : base(proxy, ElementType.EnumItem, name, attributes, unsafeCode)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertValidString(name, "name");
            Param.Ignore(attributes, initialization, unsafeCode);

            this.initialization.Value = initialization;
        }
        /// <summary>
        /// Initializes a new instance of the ObjectInitializerExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="initializers">The list of variable initializers within the 
        /// array initializer expression.</param>
        internal ObjectInitializerExpression(CodeUnitProxy proxy, ICollection<EqualsExpression> initializers)
            : base(proxy, ExpressionType.ObjectInitializer)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(initializers, "initializers");

            this.initializers.Value = initializers;
            CsLanguageService.Debug.Assert(initializers.IsReadOnly, "The collection of initializers should be read-only.");
        }