public BoundUnaryExpression(SyntaxNode syntax, BoundExpression expression, UnaryOperatorKind operatorKind, TypeSymbol expressionType)
     : base(BoundNodeKind.UnaryExpression, syntax)
 {
     Expression = expression;
     OperatorKind = operatorKind;
     Type = expressionType;
 }
예제 #2
0
 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;
 }
예제 #4
0
 public BoundFieldExpression(BoundExpression objectReference, FieldSymbol field)
     : base(BoundNodeKind.FieldExpression)
 {
     ObjectReference = objectReference;
     Field = field;
     Type = field.ValueType;
 }
예제 #5
0
 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;
 }
예제 #8
0
 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;
 }
예제 #11
0
        public BoundCompoundExpression(BoundExpression left, BoundExpression right)
            : base(BoundNodeKind.CompoundExpression)
        {
            Type = right.Type;

            Left = left;
            Right = right;
        }
예제 #12
0
 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;
 }
예제 #15
0
 public BoundAssignmentExpression(BoundExpression left, BinaryOperatorKind? operatorKind, BoundExpression right)
     : base(BoundNodeKind.AssignmentExpression)
 {
     OperatorKind = operatorKind;
     Left = left;
     Right = right;
     Type = left.Type;
 }
예제 #16
0
 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;
 }
예제 #17
0
 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;
 }
예제 #20
0
 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;
 }
예제 #21
0
 public BoundSwitchLabel(SwitchLabelSyntax syntax, BoundExpression expression)
     : base(BoundNodeKind.SwitchLabel, syntax)
 {
     Expression = expression;
 }
예제 #22
0
 private static Symbol GetSymbol(BoundExpression expression)
 {
     switch (expression.Kind)
     {
         case BoundNodeKind.FunctionInvocationExpression:
             return GetSymbol((BoundFunctionInvocationExpression)expression);
         default:
             return null;
     }
 }
예제 #23
0
 public BoundDoStatement(DoStatementSyntax syntax, BoundExpression condition, BoundStatement body)
     : base(BoundNodeKind.DoStatement, syntax)
 {
     Condition = condition;
     Body = body;
 }
예제 #24
0
 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;
     }
 }
예제 #25
0
 public BoundReturnStatement(ReturnStatementSyntax syntax, BoundExpression expressionOpt)
     : base(BoundNodeKind.ReturnStatement, syntax)
 {
     ExpressionOpt = expressionOpt;
 }
 public BoundVariableDeclaration(VariableDeclarationStatementSyntax syntax, LocalVariableSymbol variableSymbol, TypeSymbol declaredType, BoundExpression initializerOpt)
     : base(BoundNodeKind.VariableDeclaration, syntax)
 {
     VariableSymbol = variableSymbol;
     DeclaredType   = declaredType;
     InitializerOpt = initializerOpt;
 }