public BoundUnaryExpression(SyntaxNode syntax, BoundExpression expression, UnaryOperatorKind operatorKind, TypeSymbol expressionType) : base(BoundNodeKind.UnaryExpression, syntax) { Expression = expression; OperatorKind = operatorKind; Type = expressionType; }
public BoundIfStatement(IfStatementSyntax syntax, BoundExpression condition, BoundStatement consequence, BoundStatement alternativeOpt) : base(BoundNodeKind.IfStatement, syntax) { Condition = condition; Consequence = consequence; AlternativeOpt = alternativeOpt; }
public BoundMemberExpression(SyntaxNode syntax, BoundExpression objectReference, MemberSymbol member) : base(BoundNodeKind.MemberExpression, syntax) { ObjectReference = objectReference; Member = member; Type = member.AssociatedType; }
public BoundFieldExpression(BoundExpression objectReference, FieldSymbol field) : base(BoundNodeKind.FieldExpression) { ObjectReference = objectReference; Field = field; Type = field.ValueType; }
public BoundConversionExpression(BoundExpression expression, TypeSymbol type, Conversion conversion) : base(BoundNodeKind.ConversionExpression) { Expression = expression; Type = type; Conversion = conversion; }
public BoundElementAccessExpression(ElementAccessExpressionSyntax syntax, BoundExpression expression, BoundExpression index, IndexerSymbol indexer) : base(BoundNodeKind.ElementAccessExpression, syntax) { Expression = expression; Index = index; Type = indexer.AssociatedType; }
public BoundVariableDeclaration(VariableDeclarationStatementSyntax syntax, LocalVariableSymbol variableSymbol, TypeSymbol declaredType, BoundExpression initializerOpt) : base(BoundNodeKind.VariableDeclaration, syntax) { VariableSymbol = variableSymbol; DeclaredType = declaredType; InitializerOpt = initializerOpt; }
public BoundUnaryExpression(UnaryOperatorKind operatorKind, BoundExpression expression, OverloadResolutionResult<UnaryOperatorSignature> result) : base(BoundNodeKind.UnaryExpression) { OperatorKind = operatorKind; Expression = expression; Result = result; }
public BoundMethodInvocationExpression(MethodInvocationExpressionSyntax syntax, BoundExpression target, ImmutableArray<BoundExpression> arguments, OverloadResolutionResult<FunctionSymbolSignature> result) : base(BoundNodeKind.MethodInvocationExpression) { Syntax = syntax; Target = target; Arguments = arguments; Result = result; }
public BoundElementAccessExpression(BoundExpression expression, BoundExpression index, OverloadResolutionResult<IndexerSymbolSignature> result) : base(BoundNodeKind.ElementAccessExpression) { Expression = expression; Index = index; Result = result; Type = Symbol?.ValueType ?? TypeFacts.Unknown; }
public BoundCompoundExpression(BoundExpression left, BoundExpression right) : base(BoundNodeKind.CompoundExpression) { Type = right.Type; Left = left; Right = right; }
public BoundBinaryExpression(BinaryOperatorKind operatorKind, BoundExpression left, BoundExpression right, OverloadResolutionResult<BinaryOperatorSignature> result) : base(BoundNodeKind.BinaryExpression) { OperatorKind = operatorKind; Left = left; Right = right; Result = result; }
public BoundBinaryExpression(BinaryExpressionSyntax syntax, BinaryOperatorKind operatorKind, BoundExpression left, BoundExpression right, TypeSymbol type) : base(BoundNodeKind.BinaryExpression, syntax) { OperatorKind = operatorKind; Left = left; Right = right; Type = type; }
public BoundConditionalExpression(ConditionalExpressionSyntax syntax, BoundExpression condition, BoundExpression consequence, BoundExpression alternative) : base(BoundNodeKind.ConditionalExpression, syntax) { Condition = condition; Consequence = consequence; Alternative = alternative; Type = consequence.Type; }
public BoundAssignmentExpression(BoundExpression left, BinaryOperatorKind? operatorKind, BoundExpression right) : base(BoundNodeKind.AssignmentExpression) { OperatorKind = operatorKind; Left = left; Right = right; Type = left.Type; }
public BoundForStatement(ForStatementSyntax syntax, BoundVariableDeclaration declaration, ImmutableArray<BoundExpression> initializers, BoundExpression condition, ImmutableArray<BoundExpression> incrementors, BoundStatement body) : base(BoundNodeKind.ForStatement, syntax) { Declaration = declaration; Initializers = initializers; Condition = condition; Incrementors = incrementors; Body = body; }
public BoundSwitchStatement(BoundExpression expression, ImmutableArray<BoundSwitchSection> sections) : base(BoundNodeKind.SwitchStatement) { Expression = expression; Sections = sections; }
public virtual void VisitExpression(BoundExpression node) { if (node == null) throw new ArgumentNullException(nameof(node)); switch (node.Kind) { case BoundNodeKind.LiteralExpression: VisitLiteralExpression((BoundLiteralExpression) node); break; case BoundNodeKind.StringLiteralExpression: VisitStringLiteralExpression((BoundStringLiteralExpression) node); break; case BoundNodeKind.UnaryExpression: VisitUnaryExpression((BoundUnaryExpression) node); break; case BoundNodeKind.BinaryExpression: VisitBinaryExpression((BoundBinaryExpression) node); break; case BoundNodeKind.FieldExpression: VisitFieldExpression((BoundFieldExpression) node); break; case BoundNodeKind.FunctionInvocationExpression: VisitFunctionInvocationExpression((BoundFunctionInvocationExpression) node); break; case BoundNodeKind.MethodInvocationExpression: VisitMethodInvocationExpression((BoundMethodInvocationExpression) node); break; case BoundNodeKind.NumericConstructorInvocationExpression: VisitNumericConstructorInvocationExpression((BoundNumericConstructorInvocationExpression) node); break; case BoundNodeKind.AssignmentExpression: VisitAssignmentExpression((BoundAssignmentExpression) node); break; case BoundNodeKind.ConversionExpression: VisitConversionExpression((BoundConversionExpression) node); break; case BoundNodeKind.CompoundExpression: VisitCompoundExpression((BoundCompoundExpression) node); break; case BoundNodeKind.ConditionalExpression: VisitConditionExpression((BoundConditionalExpression) node); break; case BoundNodeKind.ElementAccessExpression: VisitElementAccessExpression((BoundElementAccessExpression) node); break; case BoundNodeKind.ArrayInitializerExpression: VisitArrayInitializerExpression((BoundArrayInitializerExpression) node); break; case BoundNodeKind.ErrorExpression: VisitErrorExpression((BoundErrorExpression) node); break; case BoundNodeKind.VariableExpression: VisitVariableExpression((BoundVariableExpression) node); break; case BoundNodeKind.CompileExpression: VisitCompileExpression((BoundCompileExpression)node); break; default: throw new InvalidOperationException(node.Kind.ToString()); } }
public BoundExpressionStatement(ExpressionStatementSyntax syntax, BoundExpression expression) : base(BoundNodeKind.ExpressionStatement, syntax) { Expression = expression; }
public BoundForStatement(ForStatementSyntax syntax, BoundVariableDeclaration declaration, ImmutableArray <BoundExpression> initializers, BoundExpression condition, ImmutableArray <BoundExpression> incrementors, BoundStatement body) : base(BoundNodeKind.ForStatement, syntax) { Declaration = declaration; Initializers = initializers; Condition = condition; Incrementors = incrementors; Body = body; }
public BoundSwitchLabel(SwitchLabelSyntax syntax, BoundExpression expression) : base(BoundNodeKind.SwitchLabel, syntax) { Expression = expression; }
private static Symbol GetSymbol(BoundExpression expression) { switch (expression.Kind) { case BoundNodeKind.FunctionInvocationExpression: return GetSymbol((BoundFunctionInvocationExpression)expression); default: return null; } }
public BoundDoStatement(DoStatementSyntax syntax, BoundExpression condition, BoundStatement body) : base(BoundNodeKind.DoStatement, syntax) { Condition = condition; Body = body; }
private static Symbol GetSymbol(BoundExpression expression) { switch (expression.Kind) { case BoundNodeKind.VariableExpression: return GetSymbol((BoundVariableExpression) expression); case BoundNodeKind.NumericConstructorInvocationExpression: return GetSymbol((BoundNumericConstructorInvocationExpression) expression); case BoundNodeKind.FunctionInvocationExpression: return GetSymbol((BoundFunctionInvocationExpression) expression); case BoundNodeKind.MethodInvocationExpression: return GetSymbol((BoundMethodInvocationExpression) expression); case BoundNodeKind.FieldExpression: return GetSymbol((BoundFieldExpression) expression); case BoundNodeKind.Name: return GetSymbol((BoundName) expression); case BoundNodeKind.IntrinsicGenericMatrixType: case BoundNodeKind.IntrinsicGenericVectorType: case BoundNodeKind.IntrinsicMatrixType: case BoundNodeKind.IntrinsicObjectType: case BoundNodeKind.IntrinsicScalarType: case BoundNodeKind.IntrinsicVectorType: return GetSymbol((BoundType) expression); default: // TODO: More bound expression types. return null; } }
public BoundReturnStatement(ReturnStatementSyntax syntax, BoundExpression expressionOpt) : base(BoundNodeKind.ReturnStatement, syntax) { ExpressionOpt = expressionOpt; }