Ejemplo n.º 1
0
        private void HandleReturn()
        {
            builder.MarkLabel(ReturnLabel);

            Debug.Assert(method.ReturnsVoid == (returnTemp == null));

            // in debug mode user could set a breakpoint on the last "}" of the method and
            // expect to hit it before exiting the method
            // we do it by rewriting all returns into a jump to an Exit label
            // and mark the Exit sequence with sequence point for the span of the last "}"
            BlockSyntax        blockSyntax  = null;
            SourceMethodSymbol sourceMethod = method as SourceMethodSymbol;

            if ((object)sourceMethod != null && (object)sourceMethod.IteratorElementType == null)
            {
                blockSyntax = sourceMethod.BlockSyntax;
            }

            if (blockSyntax != null && this.emitSequencePoints)
            {
                EmitSequencePoint(block.SyntaxTree ?? sourceMethod.SyntaxTree, blockSyntax.CloseBraceToken.Span);
            }

            if (returnTemp != null)
            {
                builder.EmitLocalLoad(LazyReturnTemp);
                builder.EmitRet(false);
            }
            else
            {
                builder.EmitRet(true);
            }

            indirectReturnState = IndirectReturnState.Emitted;
        }
Ejemplo n.º 2
0
        private void HandleReturn()
        {
            _builder.MarkLabel(s_returnLabel);

            Debug.Assert(_method.ReturnsVoid == (_returnTemp == null));

            if (_emitPdbSequencePoints && !_method.IsIterator && !_method.IsAsync)
            {
                // In debug mode user could set a breakpoint on the last "}" of the method and
                // expect to hit it before exiting the method.
                // We do it by rewriting all returns into a jump to an Exit label
                // and mark the Exit sequence with sequence point for the span of the last "}".
                BlockSyntax blockSyntax = _methodBodySyntaxOpt as BlockSyntax;
                if (blockSyntax != null)
                {
                    EmitSequencePoint(blockSyntax.SyntaxTree, blockSyntax.CloseBraceToken.Span);
                }
            }

            if (_returnTemp != null)
            {
                _builder.EmitLocalLoad(LazyReturnTemp);
                _builder.EmitRet(false);
            }
            else
            {
                _builder.EmitRet(true);
            }

            _indirectReturnState = IndirectReturnState.Emitted;
        }
Ejemplo n.º 3
0
        private void HandleReturn()
        {
            _builder.MarkLabel(s_returnLabel);

            Debug.Assert(_method.ReturnsVoid == (_returnTemp == null));

            if (_emitPdbSequencePoints && !_method.IsIterator && !_method.IsAsync)
            {
                // In debug mode user could set a breakpoint on the last "}" of the method and 
                // expect to hit it before exiting the method.
                // We do it by rewriting all returns into a jump to an Exit label 
                // and mark the Exit sequence with sequence point for the span of the last "}".
                BlockSyntax blockSyntax = _methodBodySyntaxOpt as BlockSyntax;
                if (blockSyntax != null)
                {
                    EmitSequencePoint(blockSyntax.SyntaxTree, blockSyntax.CloseBraceToken.Span);
                }
            }

            if (_returnTemp != null)
            {
                _builder.EmitLocalLoad(LazyReturnTemp);
                _builder.EmitRet(false);
            }
            else
            {
                _builder.EmitRet(true);
            }

            _indirectReturnState = IndirectReturnState.Emitted;
        }
Ejemplo n.º 4
0
        private void HandleReturn()
        {
            builder.MarkLabel(ReturnLabel);

            Debug.Assert(method.ReturnsVoid == (returnTemp == null));

            // in debug mode user could set a breakpoint on the last "}" of the method and 
            // expect to hit it before exiting the method
            // we do it by rewriting all returns into a jump to an Exit label 
            // and mark the Exit sequence with sequence point for the span of the last "}"
            BlockSyntax blockSyntax = null;
            SourceMethodSymbol sourceMethod = method as SourceMethodSymbol;
            if ((object)sourceMethod != null && (object)sourceMethod.IteratorElementType == null)
            {
                blockSyntax = sourceMethod.BlockSyntax;
            }

            if (blockSyntax != null && this.emitSequencePoints)
            {
                EmitSequencePoint(block.SyntaxTree ?? sourceMethod.SyntaxTree, blockSyntax.CloseBraceToken.Span);
            }

            if (returnTemp != null)
            {
                builder.EmitLocalLoad(LazyReturnTemp);
                builder.EmitRet(false);
            }
            else
            {
                builder.EmitRet(true);
            }

            indirectReturnState = IndirectReturnState.Emitted;
        }