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–355 unchanged (355 lines)
356 return;
357 }
358
359 for (Node child : node.children()) {
360 if (NodeUtil.isThis(child)) {
361 Node newName = Node.newString(Token.NAME, name);
362 node.replaceChild(child, newName);
363 } else {
364 replaceReferencesToThis(child, name);
365 }
366 }
367 }
368}
369

After

…lines 1–355 unchanged (355 lines)
356 return;
357 }
358
359 for (Node child : node.children()) {
360 if (NodeUtil.isThis(child)) {
361 Node newName = Node.newString(Token.NAME, name);
362 newName.setJSType(child.getJSType());
363 node.replaceChild(child, newName);
364 } else {
365 replaceReferencesToThis(child, name);
366 }
367 }
368 }
369}
370

Before

program
block_comment "/*\n * Copyright 2009 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 "Lists"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "DefinitionsRemover"
. "."
identifier "Definition"
; ";"
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 "JSTypeNative"
; ";"
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 "JSTypeRegistry"
; ";"
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
identifier "java"
. "."
identifier "util"
. "."
identifier "Collection"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
block_comment "/**\n * Rewrites prototyped methods calls as static calls tha"...
class_declaration
class "class"
identifier "DevirtualizePrototypeMethods"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
constructor_declaration
identifier "DevirtualizePrototypeMethods"
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 (+73 nodes collapsed)
block_comment "/**\n * Determines if the name node acts as the function na"...
method_declaration (+64 nodes collapsed)
block_comment "/**\n * Determines if the current node is a function protot"...
method_declaration (+218 nodes collapsed)
block_comment "/**\n * @returns The new name for a rewritten method.\n */"
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Rewrites method definition and call sites if the me"...
method_declaration (+194 nodes collapsed)
block_comment "/**\n * Determines if a method definition is eligible for r"...
method_declaration (+415 nodes collapsed)
block_comment "/**\n * Rewrites object method call sites as calls to globa"...
method_declaration (+141 nodes collapsed)
block_comment "/**\n * Rewrites method definitions as global functions tha"...
method_declaration (+229 nodes collapsed)
block_comment "/**\n * Creates a new JSType based on the original function"...
method_declaration (+181 nodes collapsed)
block_comment "/**\n * Replaces references to \"this\" with references to na"...
method_declaration
modifiers
private "private"
void_type "void"
identifier "replaceReferencesToThis"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "node"
, ","
formal_parameter
type_identifier "String"
identifier "name"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "NodeUtil"
. "."
identifier "isFunction"
argument_list
( "("
identifier "node"
) ")"
) ")"
block
{ "{"
return_statement
return "return"
; ";"
} "}"
enhanced_for_statement
for "for"
( "("
type_identifier "Node"
identifier "child"
: ":"
method_invocation
identifier "node"
. "."
identifier "children"
argument_list
( "("
) ")"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "NodeUtil"
. "."
identifier "isThis"
argument_list
( "("
identifier "child"
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "newName"
= "="
method_invocation
identifier "Node"
. "."
identifier "newString"
argument_list
( "("
field_access
identifier "Token"
. "."
identifier "NAME"
, ","
identifier "name"
) ")"
; ";"
expression_statement
method_invocation
identifier "node"
. "."
identifier "replaceChild"
argument_list
( "("
identifier "child"
, ","
identifier "newName"
) ")"
; ";"
} "}"
else "else"
block
{ "{"
expression_statement
method_invocation
identifier "replaceReferencesToThis"
argument_list
( "("
identifier "child"
, ","
identifier "name"
) ")"
; ";"
} "}"
} "}"
} "}"
} "}"

After

program
block_comment "/*\n * Copyright 2009 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 "Lists"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "DefinitionsRemover"
. "."
identifier "Definition"
; ";"
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 "JSTypeNative"
; ";"
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 "JSTypeRegistry"
; ";"
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
identifier "java"
. "."
identifier "util"
. "."
identifier "Collection"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
block_comment "/**\n * Rewrites prototyped methods calls as static calls tha"...
class_declaration
class "class"
identifier "DevirtualizePrototypeMethods"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
constructor_declaration
identifier "DevirtualizePrototypeMethods"
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 (+73 nodes collapsed)
block_comment "/**\n * Determines if the name node acts as the function na"...
method_declaration (+64 nodes collapsed)
block_comment "/**\n * Determines if the current node is a function protot"...
method_declaration (+218 nodes collapsed)
block_comment "/**\n * @returns The new name for a rewritten method.\n */"
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Rewrites method definition and call sites if the me"...
method_declaration (+194 nodes collapsed)
block_comment "/**\n * Determines if a method definition is eligible for r"...
method_declaration (+415 nodes collapsed)
block_comment "/**\n * Rewrites object method call sites as calls to globa"...
method_declaration (+141 nodes collapsed)
block_comment "/**\n * Rewrites method definitions as global functions tha"...
method_declaration (+229 nodes collapsed)
block_comment "/**\n * Creates a new JSType based on the original function"...
method_declaration (+181 nodes collapsed)
block_comment "/**\n * Replaces references to \"this\" with references to na"...
method_declaration
modifiers
private "private"
void_type "void"
identifier "replaceReferencesToThis"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "node"
, ","
formal_parameter
type_identifier "String"
identifier "name"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "NodeUtil"
. "."
identifier "isFunction"
argument_list
( "("
identifier "node"
) ")"
) ")"
block
{ "{"
return_statement
return "return"
; ";"
} "}"
enhanced_for_statement
for "for"
( "("
type_identifier "Node"
identifier "child"
: ":"
method_invocation
identifier "node"
. "."
identifier "children"
argument_list
( "("
) ")"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "NodeUtil"
. "."
identifier "isThis"
argument_list
( "("
identifier "child"
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "newName"
= "="
method_invocation
identifier "Node"
. "."
identifier "newString"
argument_list
( "("
field_access
identifier "Token"
. "."
identifier "NAME"
, ","
identifier "name"
) ")"
; ";"
expression_statement
method_invocation
identifier "newName"
. "."
identifier "setJSType"
argument_list
( "("
method_invocation
identifier "child"
. "."
identifier "getJSType"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
method_invocation
identifier "node"
. "."
identifier "replaceChild"
argument_list
( "("
identifier "child"
, ","
identifier "newName"
) ")"
; ";"
} "}"
else "else"
block
{ "{"
expression_statement
method_invocation
identifier "replaceReferencesToThis"
argument_list
( "("
identifier "child"
, ","
identifier "name"
) ")"
; ";"
} "}"
} "}"
} "}"
} "}"