src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/JSONWriter.java

Print this page

        

*** 36,45 **** --- 36,46 ---- import jdk.nashorn.internal.ir.BreakNode; import jdk.nashorn.internal.ir.CallNode; import jdk.nashorn.internal.ir.CaseNode; import jdk.nashorn.internal.ir.CatchNode; import jdk.nashorn.internal.ir.ContinueNode; + import jdk.nashorn.internal.ir.DebuggerNode; import jdk.nashorn.internal.ir.EmptyNode; import jdk.nashorn.internal.ir.Expression; import jdk.nashorn.internal.ir.ExpressionStatement; import jdk.nashorn.internal.ir.ForNode; import jdk.nashorn.internal.ir.FunctionNode;
*** 287,296 **** --- 288,304 ---- return leave(); } @Override + public boolean enterDebuggerNode(final DebuggerNode debuggerNode) { + enterDefault(debuggerNode); + type("DebuggerStatement"); + return leave(); + } + + @Override public boolean enterEmptyNode(final EmptyNode emptyNode) { enterDefault(emptyNode); type("EmptyStatement");
*** 300,310 **** @Override public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) { // handle debugger statement final Node expression = expressionStatement.getExpression(); if (expression instanceof RuntimeNode) { ! expression.accept(this); return false; } enterDefault(expressionStatement); --- 308,318 ---- @Override public boolean enterExpressionStatement(final ExpressionStatement expressionStatement) { // handle debugger statement final Node expression = expressionStatement.getExpression(); if (expression instanceof RuntimeNode) { ! assert false : "should not reach here: RuntimeNode"; return false; } enterDefault(expressionStatement);
*** 317,334 **** return leave(); } @Override public boolean enterBlockStatement(final BlockStatement blockStatement) { enterDefault(blockStatement); type("BlockStatement"); comma(); ! property("block"); ! blockStatement.getBlock().accept(this); ! return leave(); } @Override public boolean enterForNode(final ForNode forNode) { --- 325,346 ---- return leave(); } @Override public boolean enterBlockStatement(final BlockStatement blockStatement) { + if (blockStatement.isSynthetic()) { + final Block blk = blockStatement.getBlock(); + blk.getStatements().get(0).accept(this); + return false; + } + enterDefault(blockStatement); type("BlockStatement"); comma(); ! array("body", blockStatement.getBlock().getStatements()); return leave(); } @Override public boolean enterForNode(final ForNode forNode) {
*** 675,697 **** return leave(); } @Override public boolean enterRuntimeNode(final RuntimeNode runtimeNode) { ! final RuntimeNode.Request req = runtimeNode.getRequest(); ! ! if (req == RuntimeNode.Request.DEBUGGER) { ! enterDefault(runtimeNode); ! type("DebuggerStatement"); ! return leave(); ! } ! return false; } @Override public boolean enterSplitNode(final SplitNode splitNode) { return false; } @Override public boolean enterSwitchNode(final SwitchNode switchNode) { --- 687,703 ---- return leave(); } @Override public boolean enterRuntimeNode(final RuntimeNode runtimeNode) { ! assert false : "should not reach here: RuntimeNode"; return false; } @Override public boolean enterSplitNode(final SplitNode splitNode) { + assert false : "should reach here: SplitNode"; return false; } @Override public boolean enterSwitchNode(final SwitchNode switchNode) {