예제 #1
0
        private static BoundStatement ConstructDirectNullCheck(ParameterSymbol parameter, SyntheticBoundNodeFactory factory)
        {
            BoundExpression paramIsNullCondition;
            var             loweredLeft = factory.Parameter(parameter);

            if (loweredLeft.Type.IsNullableType())
            {
                paramIsNullCondition = factory.Not(factory.MakeNullableHasValue(loweredLeft.Syntax, loweredLeft));
            }
            else
            {
                // Examples of how we might get here:
                // int*
                // delegate*<...>
                // T where T : int? (via some indirection)
                Debug.Assert(parameter.Type.IsPointerOrFunctionPointer() ||
                             (parameter.Type.IsNullableTypeOrTypeParameter() && !parameter.Type.IsNullableType()));

                paramIsNullCondition = factory.MakeNullCheck(loweredLeft.Syntax, loweredLeft, BinaryOperatorKind.Equal);
            }

            var argumentName = ImmutableArray.Create <BoundExpression>(factory.StringLiteral(parameter.Name));
            BoundObjectCreationExpression ex = factory.New(factory.WellKnownMethod(WellKnownMember.System_ArgumentNullException__ctorString), argumentName);
            BoundThrowStatement           throwArgNullStatement = factory.Throw(ex);

            return(factory.HiddenSequencePoint(factory.If(paramIsNullCondition, throwArgNullStatement)));
        }
예제 #2
0
 public virtual BoundStatement InstrumentThrowStatement(
     BoundThrowStatement original,
     BoundStatement rewritten
     )
 {
     return(InstrumentStatement(original, rewritten));
 }
예제 #3
0
        public override BoundNode VisitThrowStatement(BoundThrowStatement node)
        {
            BoundSpillSequenceBuilder builder    = null;
            BoundExpression           expression = VisitExpression(ref builder, node.ExpressionOpt);

            return(UpdateStatement(builder, node.Update(expression)));
        }
예제 #4
0
 public override BoundStatement InstrumentThrowStatement(
     BoundThrowStatement original,
     BoundStatement rewritten
     )
 {
     return(Previous.InstrumentThrowStatement(original, rewritten));
 }
        public override BoundNode VisitThrowStatement(BoundThrowStatement node)
        {
            if (node.ExpressionOpt != null || _currentAwaitCatchFrame == null)
            {
                return(base.VisitThrowStatement(node));
            }

            return(Rethrow(_currentAwaitCatchFrame.pendingCaughtException));
        }
예제 #6
0
        public override BoundNode VisitThrowStatement(BoundThrowStatement node)
        {
            EnterStatement(node);

            BoundSpillSequenceBuilder builder    = null;
            BoundExpression           expression = VisitExpression(ref builder, node.ExpressionOpt);

            return(UpdateStatement(builder, node.Update(expression), substituteTemps: true));
        }
        public override BoundNode VisitThrowStatement(BoundThrowStatement node)
        {
            var result = (BoundStatement)base.VisitThrowStatement(node);
            if (this.Instrument && !node.WasCompilerGenerated)
            {
                result = _instrumenter.InstrumentThrowStatement(node, result);
            }

            return result;
        }
예제 #8
0
        public override BoundNode VisitThrowStatement(BoundThrowStatement node)
        {
            var result = (BoundStatement)base.VisitThrowStatement(node);

            if (this.Instrument && !node.WasCompilerGenerated)
            {
                result = _instrumenter.InstrumentThrowStatement(node, result);
            }

            return(result);
        }
        public override BoundNode VisitThrowStatement(BoundThrowStatement node)
        {
            BoundExpression expressionOpt = (BoundExpression)this.Visit(node.ExpressionOpt);

            if (expressionOpt == null || expressionOpt.Kind != BoundKind.SpillSequence)
            {
                return(node.Update(expressionOpt));
            }

            var spill = (BoundSpillSequence)expressionOpt;

            return(RewriteSpillSequenceAsBlock(spill, node.Update(spill.Value)));
        }
예제 #10
0
 public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
 {
     return Previous.InstrumentThrowStatement(original, rewritten);
 }
예제 #11
0
 public override BoundNode VisitThrowStatement(BoundThrowStatement node)
 {
     BoundSpillSequence2 ss = null;
     BoundExpression expression = VisitExpression(ref ss, node.ExpressionOpt);
     return UpdateStatement(ss, node.Update(expression));
 }
예제 #12
0
 public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
 {
     return(AddSequencePoint(base.InstrumentThrowStatement(original, rewritten)));
 }
예제 #13
0
 public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
 {
     return(AddDynamicAnalysis(original, base.InstrumentThrowStatement(original, rewritten)));
 }
예제 #14
0
 public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
 {
     return AddSequencePoint(base.InstrumentThrowStatement(original, rewritten));
 }
        public override BoundNode VisitThrowStatement(BoundThrowStatement node)
        {
            if (node.ExpressionOpt != null || _currentAwaitCatchFrame == null)
            {
                return base.VisitThrowStatement(node);
            }

            return Rethrow(_currentAwaitCatchFrame.pendingCaughtException);
        }
        public override BoundNode VisitThrowStatement(BoundThrowStatement node)
        {
            BoundExpression expressionOpt = (BoundExpression)this.Visit(node.ExpressionOpt);

            if (expressionOpt == null || expressionOpt.Kind != BoundKind.SpillSequence)
            {
                return node.Update(expressionOpt);
            }

            var spill = (BoundSpillSequence)expressionOpt;
            return RewriteSpillSequenceAsBlock(spill, node.Update(spill.Value));
        }
예제 #17
0
 public override BoundNode VisitThrowStatement(BoundThrowStatement node)
 {
     return(AddSequencePoint((BoundStatement)base.VisitThrowStatement(node)));
 }
 public override BoundNode VisitThrowStatement(BoundThrowStatement node)
 {
     return AddSequencePoint((BoundStatement)base.VisitThrowStatement(node));
 }
예제 #19
0
 public virtual BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
 {
     return InstrumentStatement(original, rewritten);
 }
예제 #20
0
 public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
 {
     return AddDynamicAnalysis(original, base.InstrumentThrowStatement(original, rewritten));
 }