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–240 unchanged (240 lines)
241 Node block = n.getLastChild();
242 Node paramName = NodeUtil.getFnParameters(n).getFirstChild();
243 Node insertionPoint = null;
244
245 // To satisfy normalization constraints, the type checking must be
246 // added after any inner function declarations.
247
248 for (Node paramType : funType.getParameters()) {
249 // Can this ever happen?
250 if (paramName == null) {
251 return;
252 }
253
…lines 254–399 unchanged (146 lines)

After

…lines 1–240 unchanged (240 lines)
241 Node block = n.getLastChild();
242 Node paramName = NodeUtil.getFnParameters(n).getFirstChild();
243 Node insertionPoint = null;
244
245 // To satisfy normalization constraints, the type checking must be
246 // added after any inner function declarations.
247 for (Node next = block.getFirstChild();
248 next != null && NodeUtil.isFunctionDeclaration(next);
249 next = next.getNext()) {
250 insertionPoint = next;
251 }
252
253 for (Node paramType : funType.getParameters()) {
254 // Can this ever happen?
255 if (paramName == null) {
256 return;
257 }
…lines 258–404 unchanged (147 lines)

Before

program
block_comment "/*\n * Copyright 2010 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 "annotations"
. "."
identifier "VisibleForTesting"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "base"
. "."
identifier "Charsets"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "ImmutableList"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Iterables"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Sets"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "io"
. "."
identifier "CharStreams"
; ";"
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 "FunctionType"
; ";"
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 "JSType"
; ";"
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 "ObjectType"
; ";"
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 "UnionType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "IOException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "InputStreamReader"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Collection"
; ";"
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 "TreeSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "javax"
. "."
identifier "annotation"
. "."
identifier "Nullable"
; ";"
block_comment "/**\n * Inserts runtime type assertions.\n *\n * <p>We add mark"...
class_declaration
class "class"
identifier "RuntimeTypeCheck"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration (+188 nodes collapsed)
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "String"
variable_declarator
identifier "logFunction"
; ";"
constructor_declaration (+37 nodes collapsed)
method_declaration (+68 nodes collapsed)
block_comment "/**\n * Inserts marker properties for user-defined interfac"...
class_declaration (+712 nodes collapsed)
block_comment "/**\n * Insert calls to the runtime type checking function "...
class_declaration
modifiers
private "private"
static "static"
class "class"
identifier "AddChecks"
superclass
extends "extends"
scoped_type_identifier
type_identifier "NodeTraversal"
. "."
type_identifier "AbstractPostOrderCallback"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
constructor_declaration (+22 nodes collapsed)
method_declaration (+83 nodes collapsed)
block_comment "/**\n * Insert checks for the parameters of the function."...
method_declaration
modifiers
private "private"
void_type "void"
identifier "visitFunction"
formal_parameters
( "("
formal_parameter
type_identifier "NodeTraversal"
identifier "t"
, ","
formal_parameter
type_identifier "Node"
identifier "n"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "FunctionType"
variable_declarator
identifier "funType"
= "="
cast_expression
( "("
type_identifier "FunctionType"
) ")"
method_invocation
identifier "n"
. "."
identifier "getJSType"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "block"
= "="
method_invocation
identifier "n"
. "."
identifier "getLastChild"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "paramName"
= "="
method_invocation
method_invocation
identifier "NodeUtil"
. "."
identifier "getFnParameters"
argument_list
( "("
identifier "n"
) ")"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "insertionPoint"
= "="
null_literal "null"
; ";"
line_comment "// To satisfy normalization constraints, the type checking m"...
line_comment "// added after any inner function declarations."
enhanced_for_statement (+169 nodes collapsed)
} "}"
method_declaration (+138 nodes collapsed)
block_comment "/**\n * Creates a function call to check that the given e"...
method_declaration (+190 nodes collapsed)
block_comment "/**\n * Creates a node which evaluates to a checker for t"...
method_declaration (+316 nodes collapsed)
} "}"
method_declaration (+57 nodes collapsed)
method_declaration (+40 nodes collapsed)
method_declaration (+140 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2010 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 "annotations"
. "."
identifier "VisibleForTesting"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "base"
. "."
identifier "Charsets"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "ImmutableList"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Iterables"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Sets"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "io"
. "."
identifier "CharStreams"
; ";"
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 "FunctionType"
; ";"
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 "JSType"
; ";"
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 "ObjectType"
; ";"
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 "UnionType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "IOException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "InputStreamReader"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Collection"
; ";"
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 "TreeSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "javax"
. "."
identifier "annotation"
. "."
identifier "Nullable"
; ";"
block_comment "/**\n * Inserts runtime type assertions.\n *\n * <p>We add mark"...
class_declaration
class "class"
identifier "RuntimeTypeCheck"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration (+188 nodes collapsed)
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "String"
variable_declarator
identifier "logFunction"
; ";"
constructor_declaration (+37 nodes collapsed)
method_declaration (+68 nodes collapsed)
block_comment "/**\n * Inserts marker properties for user-defined interfac"...
class_declaration (+712 nodes collapsed)
block_comment "/**\n * Insert calls to the runtime type checking function "...
class_declaration
modifiers
private "private"
static "static"
class "class"
identifier "AddChecks"
superclass
extends "extends"
scoped_type_identifier
type_identifier "NodeTraversal"
. "."
type_identifier "AbstractPostOrderCallback"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
constructor_declaration (+22 nodes collapsed)
method_declaration (+83 nodes collapsed)
block_comment "/**\n * Insert checks for the parameters of the function."...
method_declaration
modifiers
private "private"
void_type "void"
identifier "visitFunction"
formal_parameters
( "("
formal_parameter
type_identifier "NodeTraversal"
identifier "t"
, ","
formal_parameter
type_identifier "Node"
identifier "n"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "FunctionType"
variable_declarator
identifier "funType"
= "="
cast_expression
( "("
type_identifier "FunctionType"
) ")"
method_invocation
identifier "n"
. "."
identifier "getJSType"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "block"
= "="
method_invocation
identifier "n"
. "."
identifier "getLastChild"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "paramName"
= "="
method_invocation
method_invocation
identifier "NodeUtil"
. "."
identifier "getFnParameters"
argument_list
( "("
identifier "n"
) ")"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "insertionPoint"
= "="
null_literal "null"
; ";"
line_comment "// To satisfy normalization constraints, the type checking m"...
line_comment "// added after any inner function declarations."
for_statement
for "for"
( "("
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "next"
= "="
method_invocation
identifier "block"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
binary_expression
binary_expression
identifier "next"
!= "!="
null_literal "null"
&& "&&"
method_invocation
identifier "NodeUtil"
. "."
identifier "isFunctionDeclaration"
argument_list
( "("
identifier "next"
) ")"
; ";"
assignment_expression
identifier "next"
= "="
method_invocation
identifier "next"
. "."
identifier "getNext"
argument_list
( "("
) ")"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "insertionPoint"
= "="
identifier "next"
; ";"
} "}"
enhanced_for_statement (+169 nodes collapsed)
} "}"
method_declaration (+138 nodes collapsed)
block_comment "/**\n * Creates a function call to check that the given e"...
method_declaration (+190 nodes collapsed)
block_comment "/**\n * Creates a node which evaluates to a checker for t"...
method_declaration (+316 nodes collapsed)
} "}"
method_declaration (+57 nodes collapsed)
method_declaration (+40 nodes collapsed)
method_declaration (+140 nodes collapsed)
} "}"