jdk.nashorn.internal.ir.CatchNode Java Examples
The following examples show how to use
jdk.nashorn.internal.ir.CatchNode.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PrintVisitor.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterTryNode(final TryNode tryNode) { tryNode.toString(sb, printTypes); printLocalVariableConversion(tryNode); tryNode.getBody().accept(this); final List<Block> catchBlocks = tryNode.getCatchBlocks(); for (final Block catchBlock : catchBlocks) { final CatchNode catchNode = (CatchNode)catchBlock.getStatements().get(0); catchNode.toString(sb, printTypes); catchNode.getBody().accept(this); } final Block finallyBody = tryNode.getFinallyBody(); if (finallyBody != null) { sb.append(" finally "); finallyBody.accept(this); } for (final Block inlinedFinally : tryNode.getInlinedFinallies()) { inlinedFinally.accept(this); } return false; }
Example #2
Source File: PrintVisitor.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterTryNode(final TryNode tryNode) { tryNode.toString(sb, printTypes); printLocalVariableConversion(tryNode); tryNode.getBody().accept(this); final List<Block> catchBlocks = tryNode.getCatchBlocks(); for (final Block catchBlock : catchBlocks) { final CatchNode catchNode = (CatchNode)catchBlock.getStatements().get(0); catchNode.toString(sb, printTypes); catchNode.getBody().accept(this); } final Block finallyBody = tryNode.getFinallyBody(); if (finallyBody != null) { sb.append(" finally "); finallyBody.accept(this); } for (final Block inlinedFinally : tryNode.getInlinedFinallies()) { inlinedFinally.accept(this); } return false; }
Example #3
Source File: AssignSymbols.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { final IdentNode exception = catchNode.getException(); final Block block = lc.getCurrentBlock(); start(catchNode); // define block-local exception variable final String exname = exception.getName(); // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its // symbol is naturally internal, and should be treated as such. final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName()); // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block. final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE); symbol.clearFlag(IS_LET); return true; }
Example #4
Source File: JSONWriter.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { enterDefault(catchNode); type("CatchClause"); comma(); property("param"); catchNode.getException().accept(this); comma(); final Node guard = catchNode.getExceptionCondition(); if (guard != null) { property("guard"); guard.accept(this); comma(); } property("body"); catchNode.getBody().accept(this); return leave(); }
Example #5
Source File: JSONWriter.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { enterDefault(catchNode); type("CatchClause"); comma(); property("param"); catchNode.getException().accept(this); comma(); final Node guard = catchNode.getExceptionCondition(); if (guard != null) { property("guard"); guard.accept(this); comma(); } property("body"); catchNode.getBody().accept(this); return leave(); }
Example #6
Source File: AssignSymbols.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { final IdentNode exception = catchNode.getException(); final Block block = lc.getCurrentBlock(); start(catchNode); // define block-local exception variable final String exname = exception.getName(); // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its // symbol is naturally internal, and should be treated as such. final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName()); // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block. final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE); symbol.clearFlag(IS_LET); return true; }
Example #7
Source File: JSONWriter.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { enterDefault(catchNode); type("CatchClause"); comma(); property("param"); catchNode.getException().accept(this); comma(); final Node guard = catchNode.getExceptionCondition(); if (guard != null) { property("guard"); guard.accept(this); comma(); } property("body"); catchNode.getBody().accept(this); return leave(); }
Example #8
Source File: AssignSymbols.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { final IdentNode exception = catchNode.getException(); final Block block = lc.getCurrentBlock(); start(catchNode); // define block-local exception variable final String exname = exception.getName(); // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its // symbol is naturally internal, and should be treated as such. final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName()); // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block. final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE); symbol.clearFlag(IS_LET); return true; }
Example #9
Source File: JSONWriter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { enterDefault(catchNode); type("CatchClause"); comma(); property("param"); catchNode.getException().accept(this); comma(); final Node guard = catchNode.getExceptionCondition(); if (guard != null) { property("guard"); guard.accept(this); comma(); } property("body"); catchNode.getBody().accept(this); return leave(); }
Example #10
Source File: PrintVisitor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterTryNode(final TryNode tryNode) { tryNode.toString(sb, printTypes); printLocalVariableConversion(tryNode); tryNode.getBody().accept(this); final List<Block> catchBlocks = tryNode.getCatchBlocks(); for (final Block catchBlock : catchBlocks) { final CatchNode catchNode = (CatchNode)catchBlock.getStatements().get(0); catchNode.toString(sb, printTypes); catchNode.getBody().accept(this); } final Block finallyBody = tryNode.getFinallyBody(); if (finallyBody != null) { sb.append(" finally "); finallyBody.accept(this); } for (final Block inlinedFinally : tryNode.getInlinedFinallies()) { inlinedFinally.accept(this); } return false; }
Example #11
Source File: AssignSymbols.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { final IdentNode exception = catchNode.getException(); final Block block = lc.getCurrentBlock(); start(catchNode); // define block-local exception variable final String exname = exception.getName(); // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its // symbol is naturally internal, and should be treated as such. final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName()); // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block. final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE); symbol.clearFlag(IS_LET); return true; }
Example #12
Source File: AssignSymbols.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { final IdentNode exception = catchNode.getException(); final Block block = lc.getCurrentBlock(); start(catchNode); // define block-local exception variable final String exname = exception.getName(); // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its // symbol is naturally internal, and should be treated as such. final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName()); // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block. final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE); symbol.clearFlag(IS_LET); return true; }
Example #13
Source File: IRTranslator.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterTryNode(final TryNode tryNode) { final List<? extends CatchNode> catchNodes = tryNode.getCatches(); final List<CatchTreeImpl> catchTrees = new ArrayList<>(catchNodes.size()); for (final CatchNode catchNode : catchNodes) { catchTrees.add(new CatchTreeImpl(catchNode, translateExpr(catchNode.getException()), (BlockTree) translateBlock(catchNode.getBody()), translateExpr(catchNode.getExceptionCondition()))); } curStat = new TryTreeImpl(tryNode, (BlockTree) translateBlock(tryNode.getBody()), catchTrees, (BlockTree) translateBlock(tryNode.getFinallyBody())); return false; }
Example #14
Source File: JSONWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { enterDefault(catchNode); type("CatchClause"); comma(); property("param"); catchNode.getException().accept(this); comma(); final Node guard = catchNode.getExceptionCondition(); if (guard != null) { property("guard"); guard.accept(this); comma(); } property("body"); catchNode.getBody().accept(this); return leave(); }
Example #15
Source File: PrintVisitor.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterTryNode(final TryNode tryNode) { tryNode.toString(sb, printTypes); printLocalVariableConversion(tryNode); tryNode.getBody().accept(this); final List<Block> catchBlocks = tryNode.getCatchBlocks(); for (final Block catchBlock : catchBlocks) { final CatchNode catchNode = (CatchNode)catchBlock.getStatements().get(0); catchNode.toString(sb, printTypes); catchNode.getBody().accept(this); } final Block finallyBody = tryNode.getFinallyBody(); if (finallyBody != null) { sb.append(" finally "); finallyBody.accept(this); } for (final Block inlinedFinally : tryNode.getInlinedFinallies()) { inlinedFinally.accept(this); } return false; }
Example #16
Source File: AssignSymbols.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { final IdentNode exception = catchNode.getExceptionIdentifier(); final Block block = lc.getCurrentBlock(); start(catchNode); // define block-local exception variable final String exname = exception.getName(); // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its // symbol is naturally internal, and should be treated as such. final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName()); // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block. final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE); symbol.clearFlag(IS_LET); return true; }
Example #17
Source File: JSONWriter.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { enterDefault(catchNode); type("CatchClause"); comma(); property("param"); catchNode.getException().accept(this); comma(); final Node guard = catchNode.getExceptionCondition(); if (guard != null) { property("guard"); guard.accept(this); comma(); } property("body"); catchNode.getBody().accept(this); return leave(); }
Example #18
Source File: PrintVisitor.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterTryNode(final TryNode tryNode) { tryNode.toString(sb, printTypes); printLocalVariableConversion(tryNode); tryNode.getBody().accept(this); final List<Block> catchBlocks = tryNode.getCatchBlocks(); for (final Block catchBlock : catchBlocks) { final CatchNode catchNode = (CatchNode)catchBlock.getStatements().get(0); catchNode.toString(sb, printTypes); catchNode.getBody().accept(this); } final Block finallyBody = tryNode.getFinallyBody(); if (finallyBody != null) { sb.append(" finally "); finallyBody.accept(this); } for (final Block inlinedFinally : tryNode.getInlinedFinallies()) { inlinedFinally.accept(this); } return false; }
Example #19
Source File: AssignSymbols.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { final IdentNode exception = catchNode.getException(); final Block block = lc.getCurrentBlock(); start(catchNode); // define block-local exception variable final String exname = exception.getName(); // If the name of the exception starts with ":e", this is a synthetic catch block, likely a catch-all. Its // symbol is naturally internal, and should be treated as such. final boolean isInternal = exname.startsWith(EXCEPTION_PREFIX.symbolName()); // IS_LET flag is required to make sure symbol is not visible outside catch block. However, we need to // clear the IS_LET flag after creation to allow redefinition of symbol inside the catch block. final Symbol symbol = defineSymbol(block, exname, catchNode, IS_VAR | IS_LET | (isInternal ? IS_INTERNAL : 0) | HAS_OBJECT_VALUE); symbol.clearFlag(IS_LET); return true; }
Example #20
Source File: JSONWriter.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { enterDefault(catchNode); type("CatchClause"); comma(); property("param"); catchNode.getException().accept(this); comma(); final Node guard = catchNode.getExceptionCondition(); if (guard != null) { property("guard"); guard.accept(this); comma(); } property("body"); catchNode.getBody().accept(this); return leave(); }
Example #21
Source File: PrintVisitor.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterTryNode(final TryNode tryNode) { tryNode.toString(sb); tryNode.getBody().accept(this); final List<Block> catchBlocks = tryNode.getCatchBlocks(); for (final Block catchBlock : catchBlocks) { final CatchNode catchNode = (CatchNode)catchBlock.getStatements().get(0); catchNode.toString(sb); catchNode.getBody().accept(this); } final Block finallyBody = tryNode.getFinallyBody(); if (finallyBody != null) { sb.append(" finally "); finallyBody.accept(this); } return false; }
Example #22
Source File: Attr.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { final IdentNode exception = catchNode.getException(); final Block block = lc.getCurrentBlock(); start(catchNode); catchNestingLevel++; // define block-local exception variable final String exname = exception.getName(); final Symbol def = defineSymbol(block, exname, IS_VAR | IS_LET | IS_ALWAYS_DEFINED); newType(def, Type.OBJECT); //we can catch anything, not just ecma exceptions addLocalDef(exname); return true; }
Example #23
Source File: JSONWriter.java From nashorn with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { enterDefault(catchNode); type("CatchClause"); comma(); property("param"); catchNode.getException().accept(this); comma(); final Node guard = catchNode.getExceptionCondition(); if (guard != null) { property("guard"); guard.accept(this); comma(); } property("body"); catchNode.getBody().accept(this); return leave(); }
Example #24
Source File: Attr.java From nashorn with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { final IdentNode exception = catchNode.getException(); final Block block = lc.getCurrentBlock(); start(catchNode); catchNestingLevel++; // define block-local exception variable final String exname = exception.getName(); final Symbol def = defineSymbol(block, exname, IS_VAR | IS_LET | IS_ALWAYS_DEFINED); newType(def, Type.OBJECT); //we can catch anything, not just ecma exceptions addLocalDef(exname); return true; }
Example #25
Source File: JSONWriter.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { enterDefault(catchNode); type("CatchClause"); comma(); property("param"); catchNode.getException().accept(this); comma(); final Node guard = catchNode.getExceptionCondition(); if (guard != null) { property("guard"); guard.accept(this); comma(); } property("body"); catchNode.getBody().accept(this); return leave(); }
Example #26
Source File: PrintVisitor.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterTryNode(final TryNode tryNode) { tryNode.toString(sb); tryNode.getBody().accept(this); final List<Block> catchBlocks = tryNode.getCatchBlocks(); for (final Block catchBlock : catchBlocks) { final CatchNode catchNode = (CatchNode)catchBlock.getStatements().get(0); catchNode.toString(sb); catchNode.getBody().accept(this); } final Block finallyBody = tryNode.getFinallyBody(); if (finallyBody != null) { sb.append(" finally "); finallyBody.accept(this); } return false; }
Example #27
Source File: JSONWriter.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterCatchNode(final CatchNode catchNode) { enterDefault(catchNode); type("CatchClause"); comma(); property("param"); catchNode.getException().accept(this); comma(); final Node guard = catchNode.getExceptionCondition(); if (guard != null) { property("guard"); guard.accept(this); comma(); } property("body"); catchNode.getBody().accept(this); return leave(); }
Example #28
Source File: PrintVisitor.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterTryNode(final TryNode tryNode) { tryNode.toString(sb, printTypes); printLocalVariableConversion(tryNode); tryNode.getBody().accept(this); final List<Block> catchBlocks = tryNode.getCatchBlocks(); for (final Block catchBlock : catchBlocks) { final CatchNode catchNode = (CatchNode)catchBlock.getStatements().get(0); catchNode.toString(sb, printTypes); catchNode.getBody().accept(this); } final Block finallyBody = tryNode.getFinallyBody(); if (finallyBody != null) { sb.append(" finally "); finallyBody.accept(this); } for (final Block inlinedFinally : tryNode.getInlinedFinallies()) { inlinedFinally.accept(this); } return false; }
Example #29
Source File: Lower.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private TryNode ensureUnconditionalCatch(final TryNode tryNode) { final List<CatchNode> catches = tryNode.getCatches(); if(catches == null || catches.isEmpty() || catches.get(catches.size() - 1).getExceptionCondition() == null) { return tryNode; } // If the last catch block is conditional, add an unconditional rethrow block final List<Block> newCatchBlocks = new ArrayList<>(tryNode.getCatchBlocks()); newCatchBlocks.add(catchAllBlock(tryNode)); return tryNode.setCatchBlocks(lc, newCatchBlocks); }
Example #30
Source File: Lower.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private TryNode ensureUnconditionalCatch(final TryNode tryNode) { final List<CatchNode> catches = tryNode.getCatches(); if(catches == null || catches.isEmpty() || catches.get(catches.size() - 1).getExceptionCondition() == null) { return tryNode; } // If the last catch block is conditional, add an unconditional rethrow block final List<Block> newCatchBlocks = new ArrayList<>(tryNode.getCatchBlocks()); newCatchBlocks.add(catchAllBlock(tryNode)); return tryNode.setCatchBlocks(lc, newCatchBlocks); }