private Status executeReturn ( Stmt . Return stmt , CallStack frame , EnclosingScope scope ) { // We know that a return statement can only appear in either a function // or method declaration. It cannot appear, for example, in a type // declaration. Therefore, the enclosing declaration is a function or // method. Decl . Callable context = scope . getEnclosingScope ( FunctionOrMethodScope . class ) . getContext ( ) ; Tuple < Decl . Variable > returns = context . getReturns ( ) ; RValue [ ] values = executeExpressions ( stmt . getReturns ( ) , frame ) ; for ( int i = 0 ; i != returns . size ( ) ; ++ i ) { frame . putLocal ( returns . get ( i ) . getName ( ) , values [ i ] ) ; } return Status . RETURN ; }
Execute a Return statement at a given point in the function or method body