Пример #1
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;
        }
Пример #2
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;
        }
Пример #3
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;
        }
Пример #4
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;
        }
Пример #5
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;
        }
Пример #6
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;
        }
        /// <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;
        }
Пример #8
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;
        }
Пример #9
0
        /// <summary>
        /// Initializes a new instance of the ExpressionStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="expression">The expression within this statement.</param>
        internal ExpressionStatement(CodeUnitProxy proxy, Expression expression)
            : base(proxy, StatementType.Expression)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(expression, "expression");

            this.expression.Value = expression;
        }
Пример #10
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;
        }
Пример #11
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;
        }
Пример #12
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;
        }
Пример #13
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;
        }
Пример #14
0
        /// <summary>
        /// Initializes a new instance of the QueryGroupClause class.
        /// </summary>
        /// <param name="proxy">Proxy object for the clause.</param>
        /// <param name="expression">The expression.</param>
        /// <param name="groupByExpression">The group by expression.</param>
        internal QueryGroupClause(CodeUnitProxy proxy, Expression expression, Expression groupByExpression)
            : base(proxy, QueryClauseType.Group)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(expression, "expression");
            Param.AssertNotNull(groupByExpression, "groupByExpression");

            this.groupByExpression.Value = groupByExpression;
        }
Пример #15
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;
        }
Пример #16
0
        /// <summary>
        /// Initializes a new instance of the AsExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="value">The value to convert.</param>
        /// <param name="type">The type of the conversion.</param>
        internal AsExpression(CodeUnitProxy proxy, Expression value, LiteralExpression type)
            : base(proxy, ExpressionType.As)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(value, "value");
            Param.AssertNotNull(type, "type");

            this.value.Value = value;
            this.type.Value = CodeParser.ExtractTypeTokenFromLiteralExpression(type);
        }
        /// <summary>
        /// Initializes a new instance of the VariableDeclaratorExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="identifier">The identifier name of the variable.</param>
        /// <param name="initializer">The initialization expression for the variable.</param>
        internal VariableDeclaratorExpression(CodeUnitProxy proxy, LiteralExpression identifier, Expression initializer)
            : base(proxy, ExpressionType.VariableDeclarator)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(identifier, "identifier");
            Param.Ignore(initializer);

            this.identifier.Value = identifier;
            this.initializer.Value = initializer;
        }
Пример #18
0
        /// <summary>
        /// Initializes a new instance of the AttributeExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="target">The attribute target, if any.</param>
        /// <param name="initialization">The attribute initialization call.</param>
        internal AttributeExpression(CodeUnitProxy proxy, LiteralExpression target, Expression initialization)
            : base(proxy, ExpressionType.Attribute)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.Ignore(target);
            Param.AssertNotNull(initialization, "initialization");

            this.target.Value = target;
            this.initialization.Value = initialization;
        }
Пример #19
0
        /// <summary>
        /// Initializes a new instance of the DoWhileStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="condition">The expression within the while statement.</param>
        /// <param name="body">The body of the do-while-statement.</param>
        internal DoWhileStatement(CodeUnitProxy proxy, Expression condition, Statement body)
            : base(proxy, StatementType.DoWhile)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(condition, "condition");
            Param.AssertNotNull(body, "body");

            this.condition.Value = condition;
            this.body.Value = body;
        }
Пример #20
0
        /// <summary>
        /// Initializes a new instance of the ForeachStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="iterationVariable">The iteration variable declared in foreach statement declaration.</param>
        /// <param name="collection">The enumerable expression being iterated over.</param>
        internal ForeachStatement(CodeUnitProxy proxy, VariableDeclarationExpression iterationVariable, Expression collection)
            : base(proxy, StatementType.Foreach)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(iterationVariable, "iterationVariable");
            Param.AssertNotNull(collection, "collection");

            this.iterationVariable.Value = iterationVariable;
            this.collection.Value = collection;
        }
Пример #21
0
        /// <summary>
        /// Initializes a new instance of the CastExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="type">The cast type.</param>
        /// <param name="castedExpression">The expression being casted.</param>
        internal CastExpression(CodeUnitProxy proxy, LiteralExpression type, Expression castedExpression)
            : base(proxy, ExpressionType.Cast)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(type, "type");
            Param.AssertNotNull(castedExpression, "castedExpression");

            this.type.Value = CodeParser.ExtractTypeTokenFromLiteralExpression(type);
            this.castedExpression.Value = castedExpression;
        }
Пример #22
0
        /// <summary>
        /// Initializes a new instance of the Argument class.
        /// </summary>
        /// <param name="proxy">The proxy class.</param>
        /// <param name="modifiers">The parameter modifiers.</param>
        /// <param name="argumentExpression">The argument expression.</param>
        internal Argument(CodeUnitProxy proxy, ParameterModifiers modifiers, Expression argumentExpression)
            : base(proxy, CodeUnitType.Argument)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.Ignore(modifiers, "modifiers");
            Param.AssertNotNull(argumentExpression, "argumentExpression");

            this.modifiers.Value = modifiers;
            this.argumentExpression.Value = argumentExpression;
        }
        /// <summary>
        /// Initializes a new instance of the NullCoalescingExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="leftHandSide">The left hand side of the expression.</param>
        /// <param name="rightHandSide">The right hand side of the expression.</param>
        internal NullCoalescingExpression(CodeUnitProxy proxy, Expression leftHandSide, Expression rightHandSide)
            : base(proxy, ExpressionType.NullCoalescing)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(leftHandSide, "leftHandSide");
            Param.AssertNotNull(rightHandSide, "rightHandSide");

            this.leftHandSide.Value = leftHandSide;
            this.rightHandSide.Value = rightHandSide;
        }
Пример #24
0
        /// <summary>
        /// Initializes a new instance of the UnsafeAccessExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="type">The type of operation being performed.</param>
        /// <param name="value">The value the operator is being applied to.</param>
        internal UnsafeAccessExpression(CodeUnitProxy proxy, UnsafeAccessExpressionType type, Expression value)
            : base(proxy, (int)type)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.Ignore(type);
            Param.AssertNotNull(value, "value");

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

            this.value.Value = value;
        }
Пример #25
0
        /// <summary>
        /// Initializes a new instance of the ConditionalExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="condition">The condition being evaluated.</param>
        /// <param name="trueValue">The expression that is evaluated if the condition is true.</param>
        /// <param name="falseValue">The expression that is evaluated if the condition is false.</param>
        internal ConditionalExpression(
            CodeUnitProxy proxy, Expression condition, Expression trueValue, Expression falseValue)
            : base(proxy, ExpressionType.Conditional)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(condition, "condition");
            Param.AssertNotNull(trueValue, "trueValue");
            Param.AssertNotNull(falseValue, "falseValue");

            this.condition.Value = condition;
            this.trueValue.Value = trueValue;
            this.falseValue.Value = falseValue;
        }
Пример #26
0
        /// <summary>
        /// Initializes a new instance of the ChildAccessExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="type">The type of operation being performed.</param>
        /// <param name="leftHandSide">The left side of the operation.</param>
        /// <param name="rightHandSide">The member being accessed.</param>
        internal ChildAccessExpression(
            CodeUnitProxy proxy,
            ExpressionType type,
            Expression leftHandSide, 
            LiteralExpression rightHandSide)
            : base(proxy, (int)type)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.Ignore(type);
            Param.AssertNotNull(leftHandSide, "leftHandSide");
            Param.AssertNotNull(rightHandSide, "rightHandSide");

            this.leftHandSide.Value = leftHandSide;
            this.rightHandSide.Value = rightHandSide;
        }
Пример #27
0
        /// <summary>
        /// Initializes a new instance of the CatchStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="tryStatement">The try-statement that this catch-statement is attached to.</param>
        /// <param name="classExpression">The inner expression.</param>
        /// <param name="body">The body of the catch-statement.</param>
        internal CatchStatement(
            CodeUnitProxy proxy,
            TryStatement tryStatement,
            Expression classExpression,
            BlockStatement body)
            : base(proxy, StatementType.Catch)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(tryStatement, "tryStatement");
            Param.Ignore(classExpression);
            Param.AssertNotNull(body, "body");

            this.tryStatement.Value = tryStatement;
            this.catchExpression.Value = classExpression;
            this.body.Value = body;
        }
Пример #28
0
        /// <summary>
        /// Initializes a new instance of the QueryJoinClause class.
        /// </summary>
        /// <param name="proxy">Proxy object for the clause.</param>
        /// <param name="inExpression">The expression after the 'in' keyword.</param>
        /// <param name="onKeyExpression">The expression after the 'on' keyword.</param>
        /// <param name="equalsKeyExpression">The expression after the 'equals' keyword.</param>
        internal QueryJoinClause(
            CodeUnitProxy proxy,
            Expression inExpression, 
            Expression onKeyExpression,
            Expression equalsKeyExpression)
            : base(proxy, QueryClauseType.Join)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(inExpression, "inExpression");
            Param.AssertNotNull(onKeyExpression, "onKeyExpression");
            Param.AssertNotNull(equalsKeyExpression, "equalsKeyExpression");

            this.inExpression.Value = inExpression;
            this.onKeyExpression.Value = onKeyExpression;
            this.equalsKeyExpression.Value = equalsKeyExpression;
        }
Пример #29
0
        /// <summary>
        /// Initializes a new instance of the AssignmentExpression class.
        /// </summary>
        /// <param name="proxy">Proxy object for the expression.</param>
        /// <param name="type">The type of operation being performed.</param>
        /// <param name="leftHandSide">The left hand side of the expression.</param>
        /// <param name="rightHandSide">The right hand side of the expression.</param>
        internal AssignmentExpression(
            CodeUnitProxy proxy,
            AssignmentExpressionType type,
            Expression leftHandSide,
            Expression rightHandSide)
            : base(proxy, (int)type)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.Ignore(type);
            Param.AssertNotNull(leftHandSide, "leftHandSide");
            Param.AssertNotNull(rightHandSide, "rightHandSide");

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

            this.leftHandSide.Value = leftHandSide;
            this.rightHandSide.Value = rightHandSide;
        }
Пример #30
0
        /// <summary>
        /// Initializes a new instance of the SwitchStatement class.
        /// </summary>
        /// <param name="proxy">Proxy object for the statement.</param>
        /// <param name="switchExpression">The expression to switch off of.</param>
        /// <param name="caseStatements">The list of case statements under the switch statement.</param>
        /// <param name="defaultStatement">The default statement under the switch statement.</param>
        internal SwitchStatement(
            CodeUnitProxy proxy, 
            Expression switchExpression, 
            ICollection<SwitchCaseStatement> caseStatements, 
            SwitchDefaultStatement defaultStatement)
            : base(proxy, StatementType.Switch)
        {
            Param.AssertNotNull(proxy, "proxy");
            Param.AssertNotNull(switchExpression, "switchExpression");
            Param.AssertNotNull(caseStatements, "caseStatements");
            Param.Ignore(defaultStatement);

            this.switchExpression.Value = switchExpression;
            this.caseStatements.Value = caseStatements;
            this.defaultStatement.Value = defaultStatement;

            CsLanguageService.Debug.Assert(caseStatements.IsReadOnly, "The collection of case statements should be read-only.");
        }