Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–134 unchanged (134 lines)
135 tryMinimizeExits(catchCodeBlock, exitType, labelName);
136 }
137 /* Don't try to minimize the exits of finally blocks, as this
138 * can cause problems if it changes the completion type of the finally
139 * block. See ECMA 262 Sections 8.9 & 12.14
140 */
141 if (NodeUtil.hasFinally(n)) {
142 Node finallyBlock = n.getLastChild();
143 tryMinimizeExits(finallyBlock, exitType, labelName);
144 }
145 }
146
147 // Just a 'label'.
148 if (n.isLabel()) {
149 Node labelBlock = n.getLastChild();
150 tryMinimizeExits(labelBlock, exitType, labelName);
…lines 151–313 unchanged (163 lines)

After

…lines 1–134 unchanged (134 lines)
135 tryMinimizeExits(catchCodeBlock, exitType, labelName);
136 }
137 /* Don't try to minimize the exits of finally blocks, as this
138 * can cause problems if it changes the completion type of the finally
139 * block. See ECMA 262 Sections 8.9 & 12.14
140 */
141 }
142
143 // Just a 'label'.
144 if (n.isLabel()) {
145 Node labelBlock = n.getLastChild();
146 tryMinimizeExits(labelBlock, exitType, labelName);
147 }
…lines 148–309 unchanged (162 lines)

Before

program
block_comment "/*\n * Copyright 2009 The Closure Compiler Authors.\n *\n * Lic"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "base"
. "."
identifier "Preconditions"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "NodeTraversal"
. "."
identifier "AbstractPostOrderCallback"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "IR"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Node"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Token"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "TernaryValue"
; ";"
block_comment "/**\n * Transform the structure of the AST so that the number"...
class_declaration
class "class"
identifier "MinimizeExitPoints"
superclass
extends "extends"
type_identifier "AbstractPostOrderCallback"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
constructor_declaration
identifier "MinimizeExitPoints"
formal_parameters
( "("
formal_parameter
type_identifier "AbstractCompiler"
identifier "compiler"
) ")"
constructor_body
{ "{"
expression_statement
assignment_expression
field_access
this "this"
. "."
identifier "compiler"
= "="
identifier "compiler"
; ";"
} "}"
method_declaration (+35 nodes collapsed)
method_declaration (+250 nodes collapsed)
block_comment "/**\n * Attempts to minimize the number of explicit exit po"...
method_declaration
void_type "void"
identifier "tryMinimizeExits"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "n"
, ","
formal_parameter
integral_type
int "int"
identifier "exitType"
, ","
formal_parameter
type_identifier "String"
identifier "labelName"
) ")"
block
{ "{"
line_comment "// Just an 'exit'."
if_statement (+48 nodes collapsed)
line_comment "// Just an 'if'."
if_statement (+86 nodes collapsed)
line_comment "// Just a 'try/catch/finally'."
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "n"
. "."
identifier "isTry"
argument_list
( "("
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "tryBlock"
= "="
method_invocation
identifier "n"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
expression_statement
method_invocation
identifier "tryMinimizeExits"
argument_list
( "("
identifier "tryBlock"
, ","
identifier "exitType"
, ","
identifier "labelName"
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "allCatchNodes"
= "="
method_invocation
identifier "NodeUtil"
. "."
identifier "getCatchBlock"
argument_list
( "("
identifier "n"
) ")"
; ";"
if_statement (+70 nodes collapsed)
block_comment "/* Don't try to minimize the exits of finally blocks, as thi"...
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "NodeUtil"
. "."
identifier "hasFinally"
argument_list
( "("
identifier "n"
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "finallyBlock"
= "="
method_invocation
identifier "n"
. "."
identifier "getLastChild"
argument_list
( "("
) ")"
; ";"
expression_statement
method_invocation
identifier "tryMinimizeExits"
argument_list
( "("
identifier "finallyBlock"
, ","
identifier "exitType"
, ","
identifier "labelName"
) ")"
; ";"
} "}"
} "}"
line_comment "// Just a 'label'."
if_statement (+40 nodes collapsed)
line_comment "// TODO(johnlenz): The last case of SWITCH statement?"
line_comment "// The rest assumes a block with at least one child, bail on"...
if_statement (+32 nodes collapsed)
line_comment "// Multiple if-exits can be converted in a single pass."
line_comment "// Convert \"if (blah) break; if (blah2) break; other_stmt;\""...
line_comment "// become \"if (blah); else { if (blah2); else { other_stmt; "...
line_comment "// which will get converted to \"if (!blah && !blah2) { other"...
enhanced_for_statement (+176 nodes collapsed)
line_comment "// Now try to minimize the exits of the last child, if it is"...
line_comment "// look at what has become the last child."
for_statement (+69 nodes collapsed)
} "}"
block_comment "/**\n * Look for exits (returns, breaks, or continues, depe"...
method_declaration (+311 nodes collapsed)
block_comment "/**\n * Determines if n matches the type and name for the f"...
method_declaration (+138 nodes collapsed)
block_comment "/**\n * Move all the child nodes following start in srcPare"...
method_declaration (+115 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2009 The Closure Compiler Authors.\n *\n * Lic"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "base"
. "."
identifier "Preconditions"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "NodeTraversal"
. "."
identifier "AbstractPostOrderCallback"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "IR"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Node"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Token"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "TernaryValue"
; ";"
block_comment "/**\n * Transform the structure of the AST so that the number"...
class_declaration
class "class"
identifier "MinimizeExitPoints"
superclass
extends "extends"
type_identifier "AbstractPostOrderCallback"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
constructor_declaration
identifier "MinimizeExitPoints"
formal_parameters
( "("
formal_parameter
type_identifier "AbstractCompiler"
identifier "compiler"
) ")"
constructor_body
{ "{"
expression_statement
assignment_expression
field_access
this "this"
. "."
identifier "compiler"
= "="
identifier "compiler"
; ";"
} "}"
method_declaration (+35 nodes collapsed)
method_declaration (+250 nodes collapsed)
block_comment "/**\n * Attempts to minimize the number of explicit exit po"...
method_declaration
void_type "void"
identifier "tryMinimizeExits"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "n"
, ","
formal_parameter
integral_type
int "int"
identifier "exitType"
, ","
formal_parameter
type_identifier "String"
identifier "labelName"
) ")"
block
{ "{"
line_comment "// Just an 'exit'."
if_statement (+48 nodes collapsed)
line_comment "// Just an 'if'."
if_statement (+86 nodes collapsed)
line_comment "// Just a 'try/catch/finally'."
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "n"
. "."
identifier "isTry"
argument_list
( "("
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "tryBlock"
= "="
method_invocation
identifier "n"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
expression_statement
method_invocation
identifier "tryMinimizeExits"
argument_list
( "("
identifier "tryBlock"
, ","
identifier "exitType"
, ","
identifier "labelName"
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "allCatchNodes"
= "="
method_invocation
identifier "NodeUtil"
. "."
identifier "getCatchBlock"
argument_list
( "("
identifier "n"
) ")"
; ";"
if_statement (+70 nodes collapsed)
block_comment "/* Don't try to minimize the exits of finally blocks, as thi"...
} "}"
line_comment "// Just a 'label'."
if_statement (+40 nodes collapsed)
line_comment "// TODO(johnlenz): The last case of SWITCH statement?"
line_comment "// The rest assumes a block with at least one child, bail on"...
if_statement (+32 nodes collapsed)
line_comment "// Multiple if-exits can be converted in a single pass."
line_comment "// Convert \"if (blah) break; if (blah2) break; other_stmt;\""...
line_comment "// become \"if (blah); else { if (blah2); else { other_stmt; "...
line_comment "// which will get converted to \"if (!blah && !blah2) { other"...
enhanced_for_statement (+176 nodes collapsed)
line_comment "// Now try to minimize the exits of the last child, if it is"...
line_comment "// look at what has become the last child."
for_statement (+69 nodes collapsed)
} "}"
block_comment "/**\n * Look for exits (returns, breaks, or continues, depe"...
method_declaration (+311 nodes collapsed)
block_comment "/**\n * Determines if n matches the type and name for the f"...
method_declaration (+138 nodes collapsed)
block_comment "/**\n * Move all the child nodes following start in srcPare"...
method_declaration (+115 nodes collapsed)
} "}"