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 NewExpression class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the expression. /// </param> /// <param name="typeCreationExpression"> /// The type creation expression, or null /// for an anonymous type. /// </param> /// <param name="initializerExpression"> /// The optional initializer expression. /// </param> internal NewExpression(CsTokenList tokens, Expression typeCreationExpression, Expression initializerExpression) : base(ExpressionType.New, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.Assert( typeCreationExpression == null || typeCreationExpression.ExpressionType == ExpressionType.Literal || typeCreationExpression.ExpressionType == ExpressionType.MemberAccess || typeCreationExpression.ExpressionType == ExpressionType.MethodInvocation, "typeCreationExpression", "The type creation expression must be a valid expression type."); Param.Assert( initializerExpression == null || initializerExpression.ExpressionType == ExpressionType.ObjectInitializer || initializerExpression.ExpressionType == ExpressionType.CollectionInitializer, "initializerExpression", "The initializer expression must be null or a valid initializer expression type."); this.typeCreationExpression = typeCreationExpression; this.initializerExpression = initializerExpression; if (typeCreationExpression != null) { this.AddExpression(typeCreationExpression); } if (initializerExpression != null) { this.AddExpression(initializerExpression); } }
/// <summary> /// Initializes a new instance of the QueryJoinClause class. /// </summary> /// <param name="tokens">The list of tokens that form the clause.</param> /// <param name="rangeVariable">The variable that ranges over the values in the query result.</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> /// <param name="intoVariable">The optional variable that the result is placed into.</param> internal QueryJoinClause( CsTokenList tokens, Variable rangeVariable, Expression inExpression, Expression onKeyExpression, Expression equalsKeyExpression, Variable intoVariable) : base(QueryClauseType.Join, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(rangeVariable, "rangeVariable"); Param.AssertNotNull(inExpression, "inExpression"); Param.AssertNotNull(onKeyExpression, "onKeyExpression"); Param.AssertNotNull(equalsKeyExpression, "equalsKeyExpression"); Param.Ignore(intoVariable); this.rangeVariable = rangeVariable; this.inExpression = inExpression; this.onKeyExpression = onKeyExpression; this.equalsKeyExpression = equalsKeyExpression; this.intoVariable = intoVariable; this.AddExpression(this.inExpression); this.AddExpression(this.onKeyExpression); this.AddExpression(this.equalsKeyExpression); }
internal UnsafeAccessExpression(CsTokenList tokens, Operator operatorType, Expression value) : base(ExpressionType.UnsafeAccess, tokens) { this.operatorType = operatorType; this.value = value; base.AddExpression(value); }
internal VariableDeclarationStatement(CsTokenList tokens, bool constant, VariableDeclarationExpression expression) : base(StatementType.VariableDeclaration, tokens) { this.constant = constant; this.expression = expression; base.AddExpression(expression); }
/// <summary> /// Initializes a new instance of the SwitchStatement class. /// </summary> /// <param name="tokens">The list of tokens that form the statement.</param> /// <param name="switchItem">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( CsTokenList tokens, Expression switchItem, ICollection<SwitchCaseStatement> caseStatements, SwitchDefaultStatement defaultStatement) : base(StatementType.Switch, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(switchItem, "switchItem"); Param.AssertNotNull(caseStatements, "caseStatements"); Param.Ignore(defaultStatement); this.switchItem = switchItem; this.caseStatements = caseStatements; this.defaultStatement = defaultStatement; Debug.Assert(caseStatements.IsReadOnly, "The collection of case statements should be read-only."); this.AddExpression(switchItem); foreach (Statement statement in caseStatements) { this.AddStatement(statement); } if (defaultStatement != null) { this.AddStatement(defaultStatement); } }
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); }
/// <summary> /// Initializes a new instance of the NewExpression class. /// </summary> /// <param name="tokens">The list of tokens that form the expression.</param> /// <param name="typeCreationExpression">The type creation expression, or null /// for an anonymous type.</param> /// <param name="initializerExpression">The optional initializer expression.</param> internal NewExpression(CsTokenList tokens, Expression typeCreationExpression, Expression initializerExpression) : base(ExpressionType.New, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.Assert( typeCreationExpression == null || typeCreationExpression.ExpressionType == ExpressionType.Literal || typeCreationExpression.ExpressionType == ExpressionType.MemberAccess || typeCreationExpression.ExpressionType == ExpressionType.MethodInvocation, "typeCreationExpression", "The type creation expression must be a valid expression type."); Param.Assert( initializerExpression == null || initializerExpression.ExpressionType == ExpressionType.ObjectInitializer || initializerExpression.ExpressionType == ExpressionType.CollectionInitializer, "initializerExpression", "The initializer expression must be null or a valid initializer expression type."); this.typeCreationExpression = typeCreationExpression; this.initializerExpression = initializerExpression; if (typeCreationExpression != null) { this.AddExpression(typeCreationExpression); } if (initializerExpression != null) { this.AddExpression(initializerExpression); } }
internal IncrementExpression(CsTokenList tokens, Expression value, IncrementType incrementType) : base(ExpressionType.Increment, tokens) { this.value = value; this.incrementType = incrementType; base.AddExpression(value); }
internal TypeParameterConstraintClause(CsTokenList tokens, CsToken type, ICollection<CsToken> constraints) { this.tokens = tokens; this.type = type; this.constraints = constraints; this.tokens.Trim(); }
/// <summary> /// Initializes a new instance of the Argument class. /// </summary> /// <param name="name">The optional name of the argument.</param> /// <param name="modifiers">Modifers applied to this argument.</param> /// <param name="argumentExpression">The expression that forms the body of the argument.</param> /// <param name="location">The location of the argument in the code.</param> /// <param name="parent">The parent code part.</param> /// <param name="tokens">The tokens that form the argument.</param> /// <param name="generated">Indicates whether the argument is located within a block of generated code.</param> internal Argument( CsToken name, ParameterModifiers modifiers, Expression argumentExpression, CodeLocation location, Reference<ICodePart> parent, CsTokenList tokens, bool generated) { Param.Ignore(name); Param.Ignore(modifiers); Param.AssertNotNull(argumentExpression, "argumentExpression"); Param.AssertNotNull(location, "location"); Param.AssertNotNull(parent, "parent"); Param.Ignore(tokens); Param.Ignore(generated); this.name = name; this.modifiers = modifiers; this.argumentExpression = argumentExpression; this.location = location; this.parent = parent; this.tokens = tokens; this.generated = generated; }
internal DecrementExpression(CsTokenList tokens, Expression value, DecrementType decrementType) : base(ExpressionType.Decrement, tokens) { this.value = value; this.decrementType = decrementType; base.AddExpression(value); }
internal CatchStatement(CsTokenList tokens, Microsoft.StyleCop.CSharp.TryStatement tryStatement, Expression classExpression, BlockStatement embeddedStatement) : base(StatementType.Catch, tokens) { this.tryStatement = tryStatement; this.catchExpression = classExpression; this.embeddedStatement = embeddedStatement; if (classExpression != null) { base.AddExpression(classExpression); if (classExpression != null) { if (classExpression.ExpressionType == ExpressionType.Literal) { this.classType = ((LiteralExpression) classExpression).Token as TypeToken; } else if (classExpression.ExpressionType == ExpressionType.VariableDeclaration) { VariableDeclarationExpression expression = (VariableDeclarationExpression) classExpression; this.classType = expression.Type; foreach (VariableDeclaratorExpression expression2 in expression.Declarators) { this.identifier = expression2.Identifier.Text; break; } } } } base.AddStatement(embeddedStatement); }
internal FinallyStatement(CsTokenList tokens, Microsoft.StyleCop.CSharp.TryStatement tryStatement, BlockStatement embeddedStatement) : base(StatementType.Finally, tokens) { this.tryStatement = tryStatement; this.embeddedStatement = embeddedStatement; base.AddStatement(embeddedStatement); }
/// <summary> /// Initializes a new instance of the QueryClause class. /// </summary> /// <param name="type"> /// The type of the clause. /// </param> /// <param name="tokens"> /// The list of tokens that form the clause. /// </param> internal QueryClause(QueryClauseType type, CsTokenList tokens) : base(CodePartType.QueryClause, tokens) { Param.Ignore(type); Param.AssertNotNull(tokens, "tokens"); this.type = type; }
/// <summary> /// Initializes a new instance of the NameofExpression class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the expression. /// </param> /// <param name="name"> /// The type literal to get the name of. /// </param> internal NameofExpression(CsTokenList tokens, Expression name) : base(ExpressionType.NameOf, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(name, "name"); this.AddExpression(name); }
internal MethodInvocationExpression(CsTokenList tokens, Expression name, IList<Expression> arguments) : base(ExpressionType.MethodInvocation, tokens) { this.name = name; this.arguments = arguments; base.AddExpression(name); base.AddExpressions(arguments); }
internal DoWhileStatement(CsTokenList tokens, Expression conditionExpression, Statement embeddedStatement) : base(StatementType.DoWhile, tokens) { this.conditionExpression = conditionExpression; this.embeddedStatement = embeddedStatement; base.AddExpression(conditionExpression); base.AddStatement(embeddedStatement); }
internal IsExpression(CsTokenList tokens, Expression value, LiteralExpression type) : base(ExpressionType.Is, tokens) { this.value = value; this.type = CodeParser.ExtractTypeTokenFromLiteralExpression(type); base.AddExpression(value); base.AddExpression(type); }
internal ArrayAccessExpression(CsTokenList tokens, Expression array, ICollection<Expression> arguments) : base(ExpressionType.ArrayAccess, tokens) { this.array = array; this.arguments = arguments; base.AddExpression(array); base.AddExpressions(arguments); }
/// <summary> /// Initializes a new instance of the LiteralExpression class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the expression. /// </param> /// <param name="tokenNode"> /// The literal token node. /// </param> internal LiteralExpression(CsTokenList tokens, Node <CsToken> tokenNode) : base(ExpressionType.Literal, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(tokenNode, "token"); this.tokenNode = tokenNode; }
/// <summary> /// Initializes a new instance of the NameofExpression class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the expression. /// </param> /// <param name="name"> /// The type literal to get the name of. /// </param> internal NameofExpression(CsTokenList tokens, Expression name) : base(ExpressionType.NameOf, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(name, "name"); this.AddExpression(name); }
/// <summary> /// Initializes a new instance of the LiteralExpression class. /// </summary> /// <param name="tokens">The list of tokens that form the expression.</param> /// <param name="tokenNode">The literal token node.</param> internal LiteralExpression(CsTokenList tokens, Node<CsToken> tokenNode) : base(ExpressionType.Literal, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(tokenNode, "token"); this.tokenNode = tokenNode; }
internal NullCoalescingExpression(CsTokenList tokens, Expression leftHandSide, Expression rightHandSide) : base(ExpressionType.NullCoalescing, tokens) { this.leftHandSide = leftHandSide; this.rightHandSide = rightHandSide; base.AddExpression(leftHandSide); base.AddExpression(rightHandSide); }
/// <summary> /// Initializes a new instance of the CollectionInitializerExpression class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the expression. /// </param> /// <param name="initializers"> /// The list of variable initializers within the /// array initializer expression. /// </param> internal CollectionInitializerExpression(CsTokenList tokens, IEnumerable<Expression> initializers) : base(ExpressionType.CollectionInitializer, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(initializers, "initializers"); this.AddExpressions(initializers); }
/// <summary> /// Initializes a new instance of the FixedStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="fixedVariable"> /// The fixed variable. /// </param> internal FixedStatement(CsTokenList tokens, VariableDeclarationExpression fixedVariable) : base(StatementType.Fixed, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(fixedVariable, "fixedVariable"); this.fixedVariable = fixedVariable; this.AddExpression(fixedVariable); }
/// <summary> /// Initializes a new instance of the RefExpression class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the expression. /// </param> /// <param name="value"> /// The underlying value expression. /// </param> internal RefExpression(CsTokenList tokens, Expression value) : base(ExpressionType.Ref, tokens) { Param.AssertNotNull(tokens, nameof(tokens)); Param.AssertNotNull(value, nameof(value)); this.value = value; this.AddExpression(value); }
/// <summary> /// Initializes a new instance of the WhileStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="conditionExpression"> /// The expression within the while-statement. /// </param> internal WhileStatement(CsTokenList tokens, Expression conditionExpression) : base(StatementType.While, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(conditionExpression, "conditionExpression"); this.conditionExpression = conditionExpression; this.AddExpression(conditionExpression); }
/// <summary> /// Initializes a new instance of the UncheckedStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="embeddedStatement"> /// The block statement embedded within this unchecked statement, if any. /// </param> internal UncheckedStatement(CsTokenList tokens, BlockStatement embeddedStatement) : base(StatementType.Unchecked, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(embeddedStatement, "embeddedStatement"); this.embeddedStatement = embeddedStatement; this.AddStatement(embeddedStatement); }
/// <summary> /// Initializes a new instance of the UsingStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="resource"> /// The resource acquisition expression declared in the using statement. /// </param> internal UsingStatement(CsTokenList tokens, Expression resource) : base(StatementType.Using, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(resource, "resource"); this.resource = resource; this.AddExpression(resource); }
/// <summary> /// Initializes a new instance of the UncheckedExpression class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the expression. /// </param> /// <param name="internalExpression"> /// The expression wrapped within the unchecked expression. /// </param> internal UncheckedExpression(CsTokenList tokens, Expression internalExpression) : base(ExpressionType.Unchecked, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(internalExpression, "internalExpression"); this.internalExpression = internalExpression; this.AddExpression(internalExpression); }
/// <summary> /// Initializes a new instance of the ThrowExpression class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the expression. /// </param> /// <param name="exceptionExpression"> /// An expression that represents the exception part of the throw expression. /// </param> internal ThrowExpression(CsTokenList tokens, Expression exceptionExpression) : base(ExpressionType.Throw, tokens) { Param.AssertNotNull(tokens, nameof(tokens)); Param.AssertNotNull(exceptionExpression, nameof(exceptionExpression)); this.exceptionExpression = exceptionExpression; this.AddExpression(exceptionExpression); }
/// <summary> /// Initializes a new instance of the ConstructorInitializerStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="expression"> /// The expression within this statement. /// </param> internal ConstructorInitializerStatement(CsTokenList tokens, MethodInvocationExpression expression) : base(StatementType.ConstructorInitializer, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(expression, "expression"); this.expression = expression; this.AddExpression(expression); }
/// <summary> /// Initializes a new instance of the ParenthesizedExpression class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the expression. /// </param> /// <param name="innerExpression"> /// The expression within the parenthesis. /// </param> internal ParenthesizedExpression(CsTokenList tokens, Expression innerExpression) : base(ExpressionType.Parenthesized, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(innerExpression, "innerExpression"); this.innerExpression = innerExpression; this.AddExpression(innerExpression); }
/// <summary> /// Initializes a new instance of the QueryLetClause class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the clause. /// </param> /// <param name="rangeVariable"> /// The variable that ranges over the values in the query result. /// </param> /// <param name="expression"> /// The range expression. /// </param> internal QueryLetClause(CsTokenList tokens, Variable rangeVariable, Expression expression) : base(QueryClauseType.Let, tokens, expression) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(rangeVariable, "rangeVariable"); Param.AssertNotNull(expression, "expression"); this.rangeVariable = rangeVariable; }
/// <summary> /// Initializes a new instance of the CheckedExpression class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the expression. /// </param> /// <param name="internalExpression"> /// The expression wrapped within the checked expression. /// </param> internal CheckedExpression(CsTokenList tokens, Expression internalExpression) : base(ExpressionType.Checked, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(internalExpression, "internalExpression"); this.internalExpression = internalExpression; this.AddExpression(internalExpression); }
/// <summary> /// Initializes a new instance of the LabelStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="identifier"> /// The label identifier. /// </param> internal LabelStatement(CsTokenList tokens, LiteralExpression identifier) : base(StatementType.Label, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(identifier, "identifier"); this.identifier = identifier; this.AddExpression(identifier); }
/// <summary> /// Initializes a new instance of the ConstructorInitializerStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="expression"> /// The expression within this statement. /// </param> internal ConstructorInitializerStatement(CsTokenList tokens, MethodInvocationExpression expression) : base(StatementType.ConstructorInitializer, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(expression, "expression"); this.expression = expression; this.AddExpression(expression); }
/// <summary> /// Initializes a new instance of the DefaultValueExpression class. /// </summary> /// <param name="tokens">The list of tokens that form the expression.</param> /// <param name="type">The type to obtain the default value of.</param> internal DefaultValueExpression(CsTokenList tokens, LiteralExpression type) : base(ExpressionType.DefaultValue, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(type, "type"); this.type = CodeParser.ExtractTypeTokenFromLiteralExpression(type); this.AddExpression(type); }
/// <summary> /// Initializes a new instance of the LabelStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="identifier"> /// The label identifier. /// </param> internal LabelStatement(CsTokenList tokens, LiteralExpression identifier) : base(StatementType.Label, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(identifier, "identifier"); this.identifier = identifier; this.AddExpression(identifier); }
/// <summary> /// Initializes a new instance of the StackallocExpression class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the expression. /// </param> /// <param name="type"> /// The array type. /// </param> internal StackallocExpression(CsTokenList tokens, ArrayAccessExpression type) : base(ExpressionType.Stackalloc, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(type, "type"); this.type = type; this.AddExpression(type); }
/// <summary> /// Initializes a new instance of the ParenthesizedExpression class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the expression. /// </param> /// <param name="innerExpression"> /// The expression within the parenthesis. /// </param> internal ParenthesizedExpression(CsTokenList tokens, Expression innerExpression) : base(ExpressionType.Parenthesized, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(innerExpression, "innerExpression"); this.innerExpression = innerExpression; this.AddExpression(innerExpression); }
/// <summary> /// Initializes a new instance of the Declaration class. /// </summary> /// <param name="tokens">The array of tokens that make up the declaration.</param> /// <param name="name">The name of the element.</param> /// <param name="elementType">The type of the element.</param> /// <param name="accessModifierType">The access type of the element.</param> internal Declaration( CsTokenList tokens, string name, ElementType elementType, AccessModifierType accessModifierType) : this(tokens, name, elementType, accessModifierType, new Dictionary<CsTokenType, CsToken>(0)) { Param.Ignore(tokens, name, elementType, accessModifierType); }
/// <summary> /// Initializes a new instance of the CheckedStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="embeddedStatement"> /// The block statement embedded within this checked statement, if any. /// </param> internal CheckedStatement(CsTokenList tokens, BlockStatement embeddedStatement) : base(StatementType.Checked, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(embeddedStatement, "embeddedStatement"); this.embeddedStatement = embeddedStatement; this.AddStatement(embeddedStatement); }
/// <summary> /// Initializes a new instance of the SizeofExpression class. /// </summary> /// <param name="tokens">The list of tokens that form the expression.</param> /// <param name="type">The type to get the size of.</param> internal SizeofExpression(CsTokenList tokens, Expression type) : base(ExpressionType.Sizeof, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(type, "type"); this.type = type; this.AddExpression(type); }
/// <summary> /// Initializes a new instance of the LockStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="lockedExpression"> /// The item to lock. /// </param> internal LockStatement(CsTokenList tokens, Expression lockedExpression) : base(StatementType.Lock, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(lockedExpression, "lockedExpression"); this.lockedExpression = lockedExpression; this.AddExpression(lockedExpression); }
/// <summary> /// Initializes a new instance of the ExpressionStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="expression"> /// The expression within this statement. /// </param> internal ExpressionStatement(CsTokenList tokens, Expression expression) : base(StatementType.Expression, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(expression, "expression"); this.expression = expression; this.AddExpression(expression); }
/// <summary> /// Initializes a new instance of the QueryGroupClause class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the clause. /// </param> /// <param name="expression"> /// The expression. /// </param> /// <param name="groupByExpression"> /// The group by expression. /// </param> internal QueryGroupClause(CsTokenList tokens, Expression expression, Expression groupByExpression) : base(QueryClauseType.Group, tokens, expression) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(expression, "expression"); Param.AssertNotNull(groupByExpression, "groupByExpression"); this.groupByExpression = groupByExpression; this.AddExpression(this.groupByExpression); }
/// <summary> /// Initializes a new instance of the GotoStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="identifier"> /// The identifier of the label to jump to. /// </param> internal GotoStatement(CsTokenList tokens, Expression identifier) : base(StatementType.Goto, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(identifier, "identifier"); this.identifier = identifier; this.AddExpression(identifier); }
/// <summary> /// Initializes a new instance of the QueryClauseWithExpression class. /// </summary> /// <param name="type"> /// The type of the query clause. /// </param> /// <param name="tokens"> /// The list of tokens that form the clause. /// </param> /// <param name="expression"> /// The range expression. /// </param> internal QueryClauseWithExpression(QueryClauseType type, CsTokenList tokens, Expression expression) : base(type, tokens) { Param.Ignore(type); Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(expression, "expression"); this.expression = expression; this.AddExpression(expression); }
/// <summary> /// Initializes a new instance of the FinallyStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="tryStatement"> /// The try-statement that this finally-statement is embedded to. /// </param> /// <param name="embeddedStatement"> /// The statement embedded within the finally-statement. /// </param> internal FinallyStatement(CsTokenList tokens, TryStatement tryStatement, BlockStatement embeddedStatement) : base(StatementType.Finally, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(tryStatement, "tryStatement"); Param.AssertNotNull(embeddedStatement, "embeddedStatement"); this.tryStatement = tryStatement; this.embeddedStatement = embeddedStatement; this.AddStatement(embeddedStatement); }
/// <summary> /// Initializes a new instance of the WhenStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="whenValue"> /// The await value expression. /// </param> internal WhenStatement(CsTokenList tokens, Expression whenValue) : base(StatementType.When, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.Ignore(whenValue); this.whenValue = whenValue; if (whenValue != null) { this.AddExpression(whenValue); } }
/// <summary> /// Initializes a new instance of the ThrowStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="thrownExpression"> /// The expression being thrown, if any. /// </param> internal ThrowStatement(CsTokenList tokens, Expression thrownExpression) : base(StatementType.Throw, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.Ignore(thrownExpression); this.thrownExpression = thrownExpression; if (thrownExpression != null) { this.AddExpression(thrownExpression); } }
/// <summary> /// Initializes a new instance of the ForeachStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="variable"> /// The variable declared in for each statement declaration. /// </param> /// <param name="item"> /// The item being iterated over. /// </param> internal ForeachStatement(CsTokenList tokens, VariableDeclarationExpression variable, Expression item) : base(StatementType.Foreach, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(variable, "variable"); Param.AssertNotNull(item, "item"); this.variable = variable; this.item = item; this.AddExpression(variable); this.AddExpression(item); }
/// <summary> /// Initializes a new instance of the ReturnStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="returnValue"> /// The return value expression, if there is one. /// </param> internal ReturnStatement(CsTokenList tokens, Expression returnValue) : base(StatementType.Return, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.Ignore(returnValue); this.returnValue = returnValue; if (returnValue != null) { this.AddExpression(returnValue); } }
/// <summary> /// Initializes a new instance of the NullConditionExpression class. /// </summary> /// <param name="tokens"> /// The list of tokens that form 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 NullConditionExpression(CsTokenList tokens, Expression leftHandSide, Expression rightHandSide) : base(ExpressionType.NullCoalescing, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(leftHandSide, "leftHandSide"); Param.AssertNotNull(rightHandSide, "rightHandSide"); this.leftHandSide = leftHandSide; this.rightHandSide = rightHandSide; this.AddExpression(leftHandSide); this.AddExpression(rightHandSide); }
/// <summary> /// Initializes a new instance of the DoWhileStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="conditionExpression"> /// The expression within the while statement. /// </param> /// <param name="embeddedStatement"> /// The statement that is embedded within this do-while-statement. /// </param> internal DoWhileStatement(CsTokenList tokens, Expression conditionExpression, Statement embeddedStatement) : base(StatementType.DoWhile, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(conditionExpression, "conditionExpression"); Param.AssertNotNull(embeddedStatement, "embeddedStatement"); this.conditionExpression = conditionExpression; this.embeddedStatement = embeddedStatement; this.AddExpression(conditionExpression); this.AddStatement(embeddedStatement); }
/// <summary> /// Initializes a new instance of the AwaitStatement class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the statement. /// </param> /// <param name="awaitValue"> /// The await value expression. /// </param> internal AwaitStatement(CsTokenList tokens, Expression awaitValue) : base(StatementType.Await, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.Ignore(awaitValue); this.awaitValue = awaitValue; if (awaitValue != null) { this.AddExpression(awaitValue); } }
/// <summary> /// Initializes a new instance of the AwaitExpression class. /// </summary> /// <param name="tokens"> /// The list of tokens that form the expression. /// </param> /// <param name="internalExpression"> /// The expression wrapped within the checked expression. /// </param> internal AwaitExpression(CsTokenList tokens, Expression internalExpression) : base(ExpressionType.Await, tokens) { if (internalExpression == null) { Expression e = internalExpression; } Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(internalExpression, "internalExpression"); this.internalExpression = internalExpression; this.AddExpression(internalExpression); }
/// <summary> /// Initializes a new instance of the ConditionalExpression class. /// </summary> /// <param name="tokens"> /// The list of tokens that form 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(CsTokenList tokens, Expression condition, Expression trueValue, Expression falseValue) : base(ExpressionType.Conditional, tokens) { Param.AssertNotNull(tokens, "tokens"); Param.AssertNotNull(condition, "condition"); Param.AssertNotNull(trueValue, "trueValue"); Param.AssertNotNull(falseValue, "falseValue"); this.condition = condition; this.trueValue = trueValue; this.falseValue = falseValue; this.AddExpression(condition); this.AddExpression(trueValue); this.AddExpression(falseValue); }