< prev index next >

src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java

Print this page




 445                 for(final String name: compiler.getScriptFunctionData(fn.getId()).getExternalSymbolNames()) {
 446                     nameIsUsed(name, null);
 447                 }
 448                 // Don't bother descending into it, it must be empty anyway.
 449                 assert block.getStatements().isEmpty();
 450                 return false;
 451             }
 452 
 453             enterFunctionBody();
 454         }
 455 
 456         return true;
 457     }
 458 
 459     private boolean isUnparsedFunction(final FunctionNode fn) {
 460         return isOnDemand && fn != lc.getOutermostFunction();
 461     }
 462 
 463     @Override
 464     public boolean enterCatchNode(final CatchNode catchNode) {
 465         final IdentNode exception = catchNode.getException();
 466         final Block     block     = lc.getCurrentBlock();
 467 
 468         start(catchNode);
 469 
 470         // define block-local exception variable
 471         final String exname = exception.getName();
 472         // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its
 473         // symbol is naturally internal, and should be treated as such.
 474         final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName());
 475         // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to
 476         // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block.
 477         final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE);
 478         symbol.clearFlag(IS_LET);
 479 
 480         return true;
 481     }
 482 
 483     private void enterFunctionBody() {
 484         final FunctionNode functionNode = lc.getCurrentFunction();
 485         final Block body = lc.getCurrentBlock();




 445                 for(final String name: compiler.getScriptFunctionData(fn.getId()).getExternalSymbolNames()) {
 446                     nameIsUsed(name, null);
 447                 }
 448                 // Don't bother descending into it, it must be empty anyway.
 449                 assert block.getStatements().isEmpty();
 450                 return false;
 451             }
 452 
 453             enterFunctionBody();
 454         }
 455 
 456         return true;
 457     }
 458 
 459     private boolean isUnparsedFunction(final FunctionNode fn) {
 460         return isOnDemand && fn != lc.getOutermostFunction();
 461     }
 462 
 463     @Override
 464     public boolean enterCatchNode(final CatchNode catchNode) {
 465         final IdentNode exception = catchNode.getExceptionIdentifier();
 466         final Block     block     = lc.getCurrentBlock();
 467 
 468         start(catchNode);
 469 
 470         // define block-local exception variable
 471         final String exname = exception.getName();
 472         // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its
 473         // symbol is naturally internal, and should be treated as such.
 474         final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName());
 475         // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to
 476         // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block.
 477         final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE);
 478         symbol.clearFlag(IS_LET);
 479 
 480         return true;
 481     }
 482 
 483     private void enterFunctionBody() {
 484         final FunctionNode functionNode = lc.getCurrentFunction();
 485         final Block body = lc.getCurrentBlock();


< prev index next >