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–887 unchanged (887 lines)
888 case Token.GETELEM:
889 case Token.THROW:
890 case Token.NEW:
891 case Token.ASSIGN:
892 case Token.INC:
893 case Token.DEC:
894 return true;
895 case Token.FUNCTION:
896 return false;
897 }
898 for (Node c = n.getFirstChild(); c != null; c = c.getNext()) {
899 if (!ControlFlowGraph.isEnteringNewCfgNode(c) && mayThrowException(c)) {
900 return true;
…lines 901–996 unchanged (96 lines)

After

…lines 1–887 unchanged (887 lines)
888 case Token.GETELEM:
889 case Token.THROW:
890 case Token.NEW:
891 case Token.ASSIGN:
892 case Token.INC:
893 case Token.DEC:
894 case Token.INSTANCEOF:
895 return true;
896 case Token.FUNCTION:
897 return false;
898 }
899 for (Node c = n.getFirstChild(); c != null; c = c.getNext()) {
900 if (!ControlFlowGraph.isEnteringNewCfgNode(c) && mayThrowException(c)) {
…lines 901–997 unchanged (97 lines)

Before

program
block_comment "/*\n * Copyright 2008 Google Inc.\n *\n * Licensed under the Ap"...
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
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "HashMultimap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Maps"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Multimap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "ControlFlowGraph"
. "."
identifier "Branch"
; ";"
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 "Callback"
; ";"
import_declaration (+22 nodes collapsed)
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
identifier "java"
. "."
identifier "util"
. "."
identifier "ArrayDeque"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Comparator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Deque"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "PriorityQueue"
; ";"
block_comment "/**\n * This is a compiler pass that computes a control flow "...
class_declaration
modifiers
final "final"
class "class"
identifier "ControlFlowAnalysis"
super_interfaces
implements "implements"
type_list
type_identifier "Callback"
, ","
type_identifier "CompilerPass"
class_body
{ "{"
block_comment "/**\n * Based roughly on the first few pages of\n *\n * \""...
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration
modifiers
private "private"
generic_type
type_identifier "ControlFlowGraph"
type_arguments
< "<"
type_identifier "Node"
> ">"
variable_declarator
identifier "cfg"
; ";"
field_declaration
modifiers
private "private"
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "Node"
, ","
type_identifier "Integer"
> ">"
variable_declarator
identifier "astPosition"
; ";"
line_comment "// TODO(nicksantos): should these be node annotations?"
field_declaration (+21 nodes collapsed)
line_comment "// We order CFG nodes by by looking at the AST positions."
line_comment "// CFG nodes that come first lexically should be visited fir"...
line_comment "// they will often be executed first in the source program."
field_declaration (+111 nodes collapsed)
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "astPositionCounter"
; ";"
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "priorityCounter"
; ";"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "shouldTraverseFunctions"
; ";"
line_comment "// We need to store where we started, in case we aren't doin"...
line_comment "// for the whole scope. This happens, for example, when runn"...
line_comment "// on only the externs."
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "root"
; ";"
block_comment "/*\n * This stack captures the structure of nested TRY bloc"...
field_declaration (+25 nodes collapsed)
block_comment "/*\n * This map is used to handle the follow of FINALLY. Fo"...
field_declaration (+23 nodes collapsed)
block_comment "/**\n * Constructor.\n *\n * @param compiler Compiler ins"...
constructor_declaration (+33 nodes collapsed)
method_declaration
generic_type
type_identifier "ControlFlowGraph"
type_arguments
< "<"
type_identifier "Node"
> ">"
identifier "getCfg"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "cfg"
; ";"
} "}"
method_declaration (+333 nodes collapsed)
block_comment "/**\n * Given an entry node, find all the nodes reachable f"...
method_declaration (+194 nodes collapsed)
method_declaration (+440 nodes collapsed)
method_declaration (+397 nodes collapsed)
method_declaration (+140 nodes collapsed)
method_declaration (+85 nodes collapsed)
method_declaration (+80 nodes collapsed)
method_declaration (+289 nodes collapsed)
method_declaration (+175 nodes collapsed)
method_declaration (+232 nodes collapsed)
method_declaration (+36 nodes collapsed)
method_declaration (+52 nodes collapsed)
method_declaration (+346 nodes collapsed)
method_declaration (+100 nodes collapsed)
method_declaration (+44 nodes collapsed)
method_declaration (+24 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+297 nodes collapsed)
method_declaration (+330 nodes collapsed)
method_declaration (+242 nodes collapsed)
method_declaration (+45 nodes collapsed)
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Computes the follow() node of a given node and its "...
method_declaration (+644 nodes collapsed)
block_comment "/**\n * Computes the destination node of n when we want to "...
method_declaration (+127 nodes collapsed)
block_comment "/**\n * Connects the two nodes in the control flow graph.\n "...
method_declaration (+59 nodes collapsed)
block_comment "/**\n * Connects cfgNode to the proper CATCH block if targe"...
method_declaration (+247 nodes collapsed)
block_comment "/**\n * Get the next sibling (including itself) of one of t"...
method_declaration (+89 nodes collapsed)
block_comment "/**\n * Checks if target is actually the break target of la"...
method_declaration (+47 nodes collapsed)
block_comment "/**\n * Checks if target is actually the continue target of"...
method_declaration (+42 nodes collapsed)
block_comment "/**\n * Check if label is actually referencing the target c"...
method_declaration (+104 nodes collapsed)
block_comment "/**\n * Determines if the subtree might throw an exception."...
method_declaration
modifiers
private "private"
static "static"
boolean_type "boolean"
identifier "mayThrowException"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "n"
) ")"
block
{ "{"
switch_expression
switch "switch"
parenthesized_expression
( "("
method_invocation
identifier "n"
. "."
identifier "getType"
argument_list
( "("
) ")"
) ")"
switch_block
{ "{"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "CALL"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "GETPROP"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "GETELEM"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "THROW"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "NEW"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "ASSIGN"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "INC"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "DEC"
: ":"
return_statement
return "return"
true "true"
; ";"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "FUNCTION"
: ":"
return_statement
return "return"
false "false"
; ";"
} "}"
for_statement (+65 nodes collapsed)
return_statement
return "return"
false "false"
; ";"
} "}"
block_comment "/**\n * Determines whether the given node can be terminated"...
method_declaration (+105 nodes collapsed)
block_comment "/**\n * Determines whether the given node can be advanced w"...
method_declaration (+65 nodes collapsed)
block_comment "/**\n * A {@link ControlFlowGraph} which provides a node co"...
class_declaration (+335 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2008 Google Inc.\n *\n * Licensed under the Ap"...
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
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "HashMultimap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Maps"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Multimap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "ControlFlowGraph"
. "."
identifier "Branch"
; ";"
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 "Callback"
; ";"
import_declaration (+22 nodes collapsed)
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
identifier "java"
. "."
identifier "util"
. "."
identifier "ArrayDeque"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Comparator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Deque"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "PriorityQueue"
; ";"
block_comment "/**\n * This is a compiler pass that computes a control flow "...
class_declaration
modifiers
final "final"
class "class"
identifier "ControlFlowAnalysis"
super_interfaces
implements "implements"
type_list
type_identifier "Callback"
, ","
type_identifier "CompilerPass"
class_body
{ "{"
block_comment "/**\n * Based roughly on the first few pages of\n *\n * \""...
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration
modifiers
private "private"
generic_type
type_identifier "ControlFlowGraph"
type_arguments
< "<"
type_identifier "Node"
> ">"
variable_declarator
identifier "cfg"
; ";"
field_declaration
modifiers
private "private"
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "Node"
, ","
type_identifier "Integer"
> ">"
variable_declarator
identifier "astPosition"
; ";"
line_comment "// TODO(nicksantos): should these be node annotations?"
field_declaration (+21 nodes collapsed)
line_comment "// We order CFG nodes by by looking at the AST positions."
line_comment "// CFG nodes that come first lexically should be visited fir"...
line_comment "// they will often be executed first in the source program."
field_declaration (+111 nodes collapsed)
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "astPositionCounter"
; ";"
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "priorityCounter"
; ";"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "shouldTraverseFunctions"
; ";"
line_comment "// We need to store where we started, in case we aren't doin"...
line_comment "// for the whole scope. This happens, for example, when runn"...
line_comment "// on only the externs."
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "root"
; ";"
block_comment "/*\n * This stack captures the structure of nested TRY bloc"...
field_declaration (+25 nodes collapsed)
block_comment "/*\n * This map is used to handle the follow of FINALLY. Fo"...
field_declaration (+23 nodes collapsed)
block_comment "/**\n * Constructor.\n *\n * @param compiler Compiler ins"...
constructor_declaration (+33 nodes collapsed)
method_declaration
generic_type
type_identifier "ControlFlowGraph"
type_arguments
< "<"
type_identifier "Node"
> ">"
identifier "getCfg"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "cfg"
; ";"
} "}"
method_declaration (+333 nodes collapsed)
block_comment "/**\n * Given an entry node, find all the nodes reachable f"...
method_declaration (+194 nodes collapsed)
method_declaration (+440 nodes collapsed)
method_declaration (+397 nodes collapsed)
method_declaration (+140 nodes collapsed)
method_declaration (+85 nodes collapsed)
method_declaration (+80 nodes collapsed)
method_declaration (+289 nodes collapsed)
method_declaration (+175 nodes collapsed)
method_declaration (+232 nodes collapsed)
method_declaration (+36 nodes collapsed)
method_declaration (+52 nodes collapsed)
method_declaration (+346 nodes collapsed)
method_declaration (+100 nodes collapsed)
method_declaration (+44 nodes collapsed)
method_declaration (+24 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+297 nodes collapsed)
method_declaration (+330 nodes collapsed)
method_declaration (+242 nodes collapsed)
method_declaration (+45 nodes collapsed)
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Computes the follow() node of a given node and its "...
method_declaration (+644 nodes collapsed)
block_comment "/**\n * Computes the destination node of n when we want to "...
method_declaration (+127 nodes collapsed)
block_comment "/**\n * Connects the two nodes in the control flow graph.\n "...
method_declaration (+59 nodes collapsed)
block_comment "/**\n * Connects cfgNode to the proper CATCH block if targe"...
method_declaration (+247 nodes collapsed)
block_comment "/**\n * Get the next sibling (including itself) of one of t"...
method_declaration (+89 nodes collapsed)
block_comment "/**\n * Checks if target is actually the break target of la"...
method_declaration (+47 nodes collapsed)
block_comment "/**\n * Checks if target is actually the continue target of"...
method_declaration (+42 nodes collapsed)
block_comment "/**\n * Check if label is actually referencing the target c"...
method_declaration (+104 nodes collapsed)
block_comment "/**\n * Determines if the subtree might throw an exception."...
method_declaration
modifiers
private "private"
static "static"
boolean_type "boolean"
identifier "mayThrowException"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "n"
) ")"
block
{ "{"
switch_expression
switch "switch"
parenthesized_expression
( "("
method_invocation
identifier "n"
. "."
identifier "getType"
argument_list
( "("
) ")"
) ")"
switch_block
{ "{"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "CALL"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "GETPROP"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "GETELEM"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "THROW"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "NEW"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "ASSIGN"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "INC"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "DEC"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "INSTANCEOF"
: ":"
return_statement
return "return"
true "true"
; ";"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "FUNCTION"
: ":"
return_statement
return "return"
false "false"
; ";"
} "}"
for_statement (+65 nodes collapsed)
return_statement
return "return"
false "false"
; ";"
} "}"
block_comment "/**\n * Determines whether the given node can be terminated"...
method_declaration (+105 nodes collapsed)
block_comment "/**\n * Determines whether the given node can be advanced w"...
method_declaration (+65 nodes collapsed)
block_comment "/**\n * A {@link ControlFlowGraph} which provides a node co"...
class_declaration (+335 nodes collapsed)
} "}"