Ejemplo n.º 1
0
 public BoundAggregatedValue(ValueSlot output, AggregateSymbol aggregate, IAggregatable aggregatable, BoundExpression argument)
 {
     Output       = output;
     Aggregate    = aggregate;
     Aggregatable = aggregatable;
     Argument     = argument;
 }
Ejemplo n.º 2
0
        public static bool IsRejectingNull(BoundExpression expression, ValueSlot valueSlot)
        {
            // Only for node types listed below we can predict if the expression will yield
            // null/false. For all other node types this is unknown.

            switch (expression.Kind)
            {
            case BoundNodeKind.IsNullExpression:
                return(IsRejectingNull((BoundIsNullExpression)expression, valueSlot));

            case BoundNodeKind.UnaryExpression:
                return(IsRejectingNull((BoundUnaryExpression)expression, valueSlot));

            case BoundNodeKind.BinaryExpression:
                return(IsRejectingNull((BoundBinaryExpression)expression, valueSlot));

            case BoundNodeKind.ColumnExpression:
                return(IsRejectingNull((BoundColumnExpression)expression, valueSlot));

            case BoundNodeKind.ValueSlotExpression:
                return(IsRejectingNull((BoundValueSlotExpression)expression, valueSlot));

            case BoundNodeKind.PropertyAccessExpression:
                return(IsRejectingNull((BoundPropertyAccessExpression)expression, valueSlot));

            case BoundNodeKind.MethodInvocationExpression:
                return(IsRejectingNull((BoundMethodInvocationExpression)expression, valueSlot));

            default:
                return(false);
            }
        }
Ejemplo n.º 3
0
        private void BindToCommonType(TextSpan diagnosticSpan, ValueSlot left, ValueSlot right, out BoundExpression newLeft, out BoundExpression newRight)
        {
            newLeft  = null;
            newRight = null;

            if (left.Type == right.Type || left.Type.IsError() || right.Type.IsError())
            {
                return;
            }

            var conversionLeftToRight = Conversion.Classify(left.Type, right.Type);
            var conversionRightToLeft = Conversion.Classify(right.Type, left.Type);

            if (conversionLeftToRight.IsImplicit && conversionRightToLeft.IsImplicit)
            {
                // TODO: We may want to report an ambiguity error here.
            }

            if (conversionLeftToRight.IsImplicit)
            {
                newLeft = BindConversion(diagnosticSpan, new BoundValueSlotExpression(left), right.Type);
            }
            else
            {
                newRight = BindConversion(diagnosticSpan, new BoundValueSlotExpression(right), left.Type);
            }
        }
Ejemplo n.º 4
0
        public BoundValueSlotExpression Update(ValueSlot valueSlot)
        {
            if (valueSlot == ValueSlot)
            {
                return(this);
            }

            return(new BoundValueSlotExpression(valueSlot));
        }
Ejemplo n.º 5
0
        public BoundComparedValue Update(ValueSlot valueSlot, IComparer comparer)
        {
            if (valueSlot == ValueSlot && comparer == Comparer)
            {
                return(this);
            }

            return(new BoundComparedValue(valueSlot, comparer));
        }
Ejemplo n.º 6
0
 public BoundJoinRelation(BoundJoinType joinType, BoundRelation left, BoundRelation right, BoundExpression condition, ValueSlot probe, BoundExpression passthruPredicate)
 {
     Left              = left;
     Right             = right;
     JoinType          = joinType;
     Condition         = condition;
     Probe             = probe;
     PassthruPredicate = passthruPredicate;
 }
Ejemplo n.º 7
0
        private static bool IsRejectingNull(BoundUnaryExpression expression, ValueSlot valueSlot)
        {
            if (expression.OperatorKind == UnaryOperatorKind.LogicalNot)
            {
                return(!IsRejectingNull(expression.Expression, valueSlot));
            }

            return(IsRejectingNull(expression.Expression, valueSlot));
        }
Ejemplo n.º 8
0
        public BoundAggregatedValue Update(ValueSlot output, AggregateSymbol aggregate, IAggregatable aggregatable, BoundExpression argument)
        {
            if (output == Output && aggregate == Aggregate && aggregatable == Aggregatable && argument == Argument)
            {
                return(this);
            }

            return(new BoundAggregatedValue(output, aggregate, aggregatable, argument));
        }
Ejemplo n.º 9
0
        public BoundSingleRowSubselect Update(ValueSlot value, BoundRelation relation)
        {
            if (value == Value && relation == Relation)
            {
                return(this);
            }

            return(new BoundSingleRowSubselect(value, relation));
        }
Ejemplo n.º 10
0
        public BoundComputedValue Update(BoundExpression expression, ValueSlot valueSlot)
        {
            if (expression == Expression && valueSlot == ValueSlot)
            {
                return(this);
            }

            return(new BoundComputedValue(expression, valueSlot));
        }
Ejemplo n.º 11
0
 public BoundHashMatchRelation(BoundHashMatchOperator logicalOperator, BoundRelation build, BoundRelation probe, ValueSlot buildKey, ValueSlot probeKey, BoundExpression remainder)
 {
     LogicalOperator = logicalOperator;
     Build           = build;
     Probe           = probe;
     BuildKey        = buildKey;
     ProbeKey        = probeKey;
     Remainder       = remainder;
 }
Ejemplo n.º 12
0
        public BoundUnifiedValue Update(ValueSlot valueSlot, IEnumerable <ValueSlot> inputValueSlots)
        {
            var newInputValueSlots = inputValueSlots.ToImmutableArray();

            if (valueSlot == ValueSlot && newInputValueSlots == InputValueSlots)
            {
                return(this);
            }

            return(new BoundUnifiedValue(valueSlot, newInputValueSlots));
        }
Ejemplo n.º 13
0
        private static bool IsRejectingNull(BoundBinaryExpression expression, ValueSlot valueSlot)
        {
            if (expression.OperatorKind == BinaryOperatorKind.LogicalOr)
            {
                // Special handling for logical OR:
                // For logical OR both arguments must be NULL to yield FALSE/NULL.

                return(IsRejectingNull(expression.Left, valueSlot) &&
                       IsRejectingNull(expression.Right, valueSlot));
            }

            // In all other cases we know the result will be FALSE/NULL if
            // any operand is NULL.

            return(IsRejectingNull(expression.Left, valueSlot) ||
                   IsRejectingNull(expression.Right, valueSlot));
        }
Ejemplo n.º 14
0
 public BoundComputedValue(BoundExpression expression, ValueSlot valueSlot)
 {
     Expression = expression;
     ValueSlot  = valueSlot;
 }
 protected virtual ValueSlot RewriteValueSlot(ValueSlot valueSlot)
 {
     return(valueSlot);
 }
Ejemplo n.º 16
0
 public BoundSingleRowSubselect(ValueSlot value, BoundRelation relation)
 {
     Value    = value;
     Relation = relation;
 }
Ejemplo n.º 17
0
 private static bool IsRejectingNull(BoundIsNullExpression expression, ValueSlot valueSlot)
 {
     return(!IsRejectingNull(expression.Expression, valueSlot));
 }
Ejemplo n.º 18
0
 public BoundOrderBySelector(ValueSlot valueSlot, BoundComputedValueWithSyntax?computedValue)
 {
     ValueSlot     = valueSlot;
     ComputedValue = computedValue;
 }
Ejemplo n.º 19
0
        public BoundJoinRelation Update(BoundJoinType joinType, BoundRelation left, BoundRelation right, BoundExpression condition, ValueSlot probe, BoundExpression passthruPredicate)
        {
            if (joinType == JoinType && left == Left && right == Right && condition == Condition && probe == Probe && passthruPredicate == PassthruPredicate)
            {
                return(this);
            }

            return(new BoundJoinRelation(joinType, left, right, condition, probe, passthruPredicate));
        }
Ejemplo n.º 20
0
 public BoundComparedValue(ValueSlot valueSlot, IComparer comparer)
 {
     ValueSlot = valueSlot;
     Comparer  = comparer;
 }
 public BoundComputedValueWithSyntax(ExpressionSyntax syntax, BoundExpression expression, ValueSlot result)
 {
     Syntax     = syntax;
     Expression = expression;
     Result     = result;
 }
Ejemplo n.º 22
0
 public BoundValueSlotExpression(ValueSlot valueSlot)
 {
     ValueSlot = valueSlot;
 }
Ejemplo n.º 23
0
 private static bool IsRejectingNull(BoundColumnExpression expression, ValueSlot valueSlot)
 {
     return(expression.Symbol.ValueSlot == valueSlot);
 }
Ejemplo n.º 24
0
 private static bool IsRejectingNull(BoundValueSlotExpression expression, ValueSlot valueSlot)
 {
     return(expression.ValueSlot == valueSlot);
 }
Ejemplo n.º 25
0
 private static bool IsRejectingNull(BoundPropertyAccessExpression expression, ValueSlot valueSlot)
 {
     return(IsRejectingNull(expression.Target, valueSlot));
 }
Ejemplo n.º 26
0
 public BoundUnifiedValue(ValueSlot valueSlot, IEnumerable <ValueSlot> inputValueSlots)
 {
     ValueSlot       = valueSlot;
     InputValueSlots = inputValueSlots.ToImmutableArray();
 }
Ejemplo n.º 27
0
        public BoundHashMatchRelation Update(BoundHashMatchOperator logicalOperator, BoundRelation build, BoundRelation probe, ValueSlot buildKey, ValueSlot probeKey, BoundExpression remainder)
        {
            if (logicalOperator == LogicalOperator && build == Build && probe == Probe && buildKey == BuildKey && probeKey == ProbeKey && remainder == Remainder)
            {
                return(this);
            }

            return(new BoundHashMatchRelation(logicalOperator, build, probe, buildKey, probeKey, remainder));
        }
Ejemplo n.º 28
0
        private static bool IsRejectingNull(BoundMethodInvocationExpression expression, ValueSlot valueSlot)
        {
            // NOTE: Arguments being NULL doesn't necessarily mean that the result will be NULL.

            return(IsRejectingNull(expression.Target, valueSlot));
        }