Esempio n. 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)));
        }
Esempio n. 2
0
 public virtual BoundStatement InstrumentThrowStatement(
     BoundThrowStatement original,
     BoundStatement rewritten
     )
 {
     return(InstrumentStatement(original, rewritten));
 }
Esempio n. 3
0
        public override BoundNode VisitThrowStatement(BoundThrowStatement node)
        {
            BoundSpillSequenceBuilder builder    = null;
            BoundExpression           expression = VisitExpression(ref builder, node.ExpressionOpt);

            return(UpdateStatement(builder, node.Update(expression)));
        }
Esempio n. 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));
        }
Esempio n. 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;
        }
Esempio n. 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)));
        }
Esempio n. 10
0
 public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
 {
     return Previous.InstrumentThrowStatement(original, rewritten);
 }
Esempio n. 11
0
 public override BoundNode VisitThrowStatement(BoundThrowStatement node)
 {
     BoundSpillSequence2 ss = null;
     BoundExpression expression = VisitExpression(ref ss, node.ExpressionOpt);
     return UpdateStatement(ss, node.Update(expression));
 }
Esempio n. 12
0
 public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
 {
     return(AddSequencePoint(base.InstrumentThrowStatement(original, rewritten)));
 }
Esempio n. 13
0
 public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
 {
     return(AddDynamicAnalysis(original, base.InstrumentThrowStatement(original, rewritten)));
 }
Esempio n. 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));
        }
Esempio n. 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));
 }
Esempio n. 19
0
 public virtual BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
 {
     return InstrumentStatement(original, rewritten);
 }
Esempio n. 20
0
 public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
 {
     return AddDynamicAnalysis(original, base.InstrumentThrowStatement(original, rewritten));
 }