private RValue [ ] executeIndirectInvoke ( Expr . IndirectInvoke expr , CallStack frame ) { RValue . Lambda src = executeExpression ( LAMBDA_T , expr . getSource ( ) , frame ) ; RValue [ ] arguments = executeExpressions ( expr . getArguments ( ) , frame ) ; // Here we have to use the enclosing frame when the lambda was created. // The reason for this is that the lambda may try to access enclosing // variables in the scope it was created. frame = src . getFrame ( ) ; extractParameters ( frame , arguments , src . getContext ( ) ) ; // Execute the method or function body Stmt body = src . getBody ( ) ; if ( body instanceof Stmt . Block ) { executeBlock ( ( Stmt . Block ) body , frame , new FunctionOrMethodScope ( src . getContext ( ) ) ) ; // Extra the return values return packReturns ( frame , src . getContext ( ) ) ; } else { RValue retval = executeExpression ( ANY_T , ( Expr ) body , frame ) ; return new RValue [ ] { retval } ; } }
Execute an IndirectInvoke bytecode instruction at a given point in the function or method body . This first checks the operand is a function reference and then generates a recursive call to execute the given function . If the function does not exist or is provided with the wrong number of arguments then a runtime fault will occur .