Пример #1
0
 public BoundUnaryExpression(UnaryOperatorKind operatorKind, BoundExpression expression, OverloadResolutionResult<UnaryOperatorSignature> result)
     : base(BoundNodeKind.UnaryExpression)
 {
     OperatorKind = operatorKind;
     Expression = expression;
     Result = result;
 }
 public BoundConversionExpression(BoundExpression expression, TypeSymbol type, Conversion conversion)
     : base(BoundNodeKind.ConversionExpression)
 {
     Expression = expression;
     Type = type;
     Conversion = conversion;
 }
Пример #3
0
 public BoundFieldExpression(BoundExpression objectReference, FieldSymbol field)
     : base(BoundNodeKind.FieldExpression)
 {
     ObjectReference = objectReference;
     Field = field;
     Type = field.ValueType;
 }
 public BoundAssignmentExpression(BoundExpression left, BinaryOperatorKind? operatorKind, BoundExpression right)
     : base(BoundNodeKind.AssignmentExpression)
 {
     OperatorKind = operatorKind;
     Left = left;
     Right = right;
     Type = left.Type;
 }
 public BoundConditionalExpression(BoundExpression condition, BoundExpression consequence, BoundExpression alternative)
     : base(BoundNodeKind.ConditionalExpression)
 {
     Condition = condition;
     Consequence = consequence;
     Alternative = alternative;
     Type = consequence.Type;
 }
 public BoundMethodInvocationExpression(MethodInvocationExpressionSyntax syntax, BoundExpression target, ImmutableArray<BoundExpression> arguments, OverloadResolutionResult<FunctionSymbolSignature> result)
     : base(BoundNodeKind.MethodInvocationExpression)
 {
     Syntax = syntax;
     Target = target;
     Arguments = arguments;
     Result = result;
 }
Пример #7
0
 public BoundBinaryExpression(BinaryOperatorKind operatorKind, BoundExpression left, BoundExpression right, OverloadResolutionResult<BinaryOperatorSignature> result)
     : base(BoundNodeKind.BinaryExpression)
 {
     OperatorKind = operatorKind;
     Left = left;
     Right = right;
     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;
 }
Пример #9
0
        public BoundCompoundExpression(BoundExpression left, BoundExpression right)
            : base(BoundNodeKind.CompoundExpression)
        {
            Type = right.Type;

            Left = left;
            Right = right;
        }
Пример #10
0
 public BoundSwitchStatement(BoundExpression expression, ImmutableArray<BoundSwitchSection> sections)
     : base(BoundNodeKind.SwitchStatement)
 {
     Expression = expression;
     Sections = sections;
 }
Пример #11
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;
     }
 }
        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 BoundSwitchStatement(BoundExpression expression, ImmutableArray <BoundSwitchSection> sections)
     : base(BoundNodeKind.SwitchStatement)
 {
     Expression = expression;
     Sections   = sections;
 }
 public BoundConditionalExpression(BoundExpression condition, BoundExpression consequence, BoundExpression alternative)
     : base(BoundNodeKind.ConditionalExpression)
 {
     Condition   = condition;
     Consequence = consequence;
     Alternative = alternative;
     Type        = consequence.Type;
 }