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–175 unchanged (175 lines)
176 break;
177 case Token.NULL:
178 case Token.OBJECTLIT:
179 case Token.ARRAYLIT:
180 typeNameString = "object";
181 break;
182 case Token.NAME:
183 // We assume here that programs don't change the value of the
184 // keyword undefined to something other than the value undefined.
185 if ("undefined".equals(argumentNode.getString())) {
186 typeNameString = "undefined";
187 }
188 break;
…lines 189–1190 unchanged (1002 lines)

After

…lines 1–175 unchanged (175 lines)
176 break;
177 case Token.NULL:
178 case Token.OBJECTLIT:
179 case Token.ARRAYLIT:
180 typeNameString = "object";
181 break;
182 case Token.VOID:
183 typeNameString = "undefined";
184 break;
185 case Token.NAME:
186 // We assume here that programs don't change the value of the
187 // keyword undefined to something other than the value undefined.
188 if ("undefined".equals(argumentNode.getString())) {
189 typeNameString = "undefined";
190 }
…lines 191–1193 unchanged (1003 lines)

Before

program
block_comment "/*\n * Copyright 2004 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
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"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
block_comment "/**\n * Peephole optimization to fold constants (e.g. x + 1 +"...
class_declaration
modifiers
public "public"
class "class"
identifier "PeepholeFoldConstants"
superclass
extends "extends"
type_identifier "AbstractPeepholeOptimization"
class_body
{ "{"
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+21 nodes collapsed)
method_declaration (+111 nodes collapsed)
method_declaration (+410 nodes collapsed)
block_comment "/**\n * Folds 'typeof(foo)' if foo is a literal, e.g.\n * "...
method_declaration
modifiers
private "private"
type_identifier "Node"
identifier "tryFoldTypeof"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "originalTypeofNode"
) ")"
block
{ "{"
expression_statement (+22 nodes collapsed)
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "argumentNode"
= "="
method_invocation
identifier "originalTypeofNode"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
if_statement (+28 nodes collapsed)
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "typeNameString"
= "="
null_literal "null"
; ";"
switch_expression
switch "switch"
parenthesized_expression
( "("
method_invocation
identifier "argumentNode"
. "."
identifier "getType"
argument_list
( "("
) ")"
) ")"
switch_block
{ "{"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "STRING"
: ":"
expression_statement
assignment_expression
identifier "typeNameString"
= "="
string_literal
" "\""
string_fragment "string"
" "\""
; ";"
break_statement
break "break"
; ";"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "NUMBER"
: ":"
expression_statement
assignment_expression
identifier "typeNameString"
= "="
string_literal
" "\""
string_fragment "number"
" "\""
; ";"
break_statement
break "break"
; ";"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "TRUE"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "FALSE"
: ":"
expression_statement
assignment_expression
identifier "typeNameString"
= "="
string_literal
" "\""
string_fragment "boolean"
" "\""
; ";"
break_statement
break "break"
; ";"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "NULL"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "OBJECTLIT"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "ARRAYLIT"
: ":"
expression_statement
assignment_expression
identifier "typeNameString"
= "="
string_literal
" "\""
string_fragment "object"
" "\""
; ";"
break_statement
break "break"
; ";"
switch_block_statement_group (+47 nodes collapsed)
} "}"
if_statement (+55 nodes collapsed)
return_statement
return "return"
identifier "originalTypeofNode"
; ";"
} "}"
method_declaration (+631 nodes collapsed)
block_comment "/**\n * Try to fold {@code left instanceof right} into {@co"...
method_declaration (+214 nodes collapsed)
method_declaration (+463 nodes collapsed)
block_comment "/**\n * Try to fold a AND/OR node.\n */"
method_declaration (+430 nodes collapsed)
block_comment "/**\n * Expressions such as [foo() + 'a' + 'b'] generate pa"...
method_declaration (+227 nodes collapsed)
block_comment "/**\n * Try to fold an ADD node with constant operands\n *"...
method_declaration (+173 nodes collapsed)
block_comment "/**\n * Try to fold arithmetic binary operators\n */"
method_declaration (+350 nodes collapsed)
method_declaration (+102 nodes collapsed)
block_comment "/**\n * Try to fold arithmetic binary operators\n */"
method_declaration (+352 nodes collapsed)
block_comment "/**\n * Try to fold shift operations\n */"
method_declaration (+410 nodes collapsed)
block_comment "/**\n * Try to fold comparison nodes, e.g ==\n */"
method_declaration (+1495 nodes collapsed)
method_declaration (+62 nodes collapsed)
block_comment "/**\n * Try to evaluate String.indexOf/lastIndexOf:\n * "...
method_declaration (+485 nodes collapsed)
block_comment "/**\n * Try to fold an array join: ['a', 'b', 'c'].join('')"...
method_declaration (+881 nodes collapsed)
block_comment "/**\n * Try to fold array-element. e.g [1, 2, 3][10];\n */"
method_declaration (+295 nodes collapsed)
block_comment "/**\n * Try to fold array-length. e.g [1, 2, 3].length ==> "...
method_declaration (+253 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2004 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
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"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
block_comment "/**\n * Peephole optimization to fold constants (e.g. x + 1 +"...
class_declaration
modifiers
public "public"
class "class"
identifier "PeepholeFoldConstants"
superclass
extends "extends"
type_identifier "AbstractPeepholeOptimization"
class_body
{ "{"
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+21 nodes collapsed)
method_declaration (+111 nodes collapsed)
method_declaration (+410 nodes collapsed)
block_comment "/**\n * Folds 'typeof(foo)' if foo is a literal, e.g.\n * "...
method_declaration
modifiers
private "private"
type_identifier "Node"
identifier "tryFoldTypeof"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "originalTypeofNode"
) ")"
block
{ "{"
expression_statement (+22 nodes collapsed)
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "argumentNode"
= "="
method_invocation
identifier "originalTypeofNode"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
if_statement (+28 nodes collapsed)
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "typeNameString"
= "="
null_literal "null"
; ";"
switch_expression
switch "switch"
parenthesized_expression
( "("
method_invocation
identifier "argumentNode"
. "."
identifier "getType"
argument_list
( "("
) ")"
) ")"
switch_block
{ "{"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "STRING"
: ":"
expression_statement
assignment_expression
identifier "typeNameString"
= "="
string_literal
" "\""
string_fragment "string"
" "\""
; ";"
break_statement
break "break"
; ";"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "NUMBER"
: ":"
expression_statement
assignment_expression
identifier "typeNameString"
= "="
string_literal
" "\""
string_fragment "number"
" "\""
; ";"
break_statement
break "break"
; ";"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "TRUE"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "FALSE"
: ":"
expression_statement
assignment_expression
identifier "typeNameString"
= "="
string_literal
" "\""
string_fragment "boolean"
" "\""
; ";"
break_statement
break "break"
; ";"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "NULL"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "OBJECTLIT"
: ":"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "ARRAYLIT"
: ":"
expression_statement
assignment_expression
identifier "typeNameString"
= "="
string_literal
" "\""
string_fragment "object"
" "\""
; ";"
break_statement
break "break"
; ";"
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "VOID"
: ":"
expression_statement
assignment_expression
identifier "typeNameString"
= "="
string_literal
" "\""
string_fragment "undefined"
" "\""
; ";"
break_statement
break "break"
; ";"
switch_block_statement_group (+47 nodes collapsed)
} "}"
if_statement (+55 nodes collapsed)
return_statement
return "return"
identifier "originalTypeofNode"
; ";"
} "}"
method_declaration (+631 nodes collapsed)
block_comment "/**\n * Try to fold {@code left instanceof right} into {@co"...
method_declaration (+214 nodes collapsed)
method_declaration (+463 nodes collapsed)
block_comment "/**\n * Try to fold a AND/OR node.\n */"
method_declaration (+430 nodes collapsed)
block_comment "/**\n * Expressions such as [foo() + 'a' + 'b'] generate pa"...
method_declaration (+227 nodes collapsed)
block_comment "/**\n * Try to fold an ADD node with constant operands\n *"...
method_declaration (+173 nodes collapsed)
block_comment "/**\n * Try to fold arithmetic binary operators\n */"
method_declaration (+350 nodes collapsed)
method_declaration (+102 nodes collapsed)
block_comment "/**\n * Try to fold arithmetic binary operators\n */"
method_declaration (+352 nodes collapsed)
block_comment "/**\n * Try to fold shift operations\n */"
method_declaration (+410 nodes collapsed)
block_comment "/**\n * Try to fold comparison nodes, e.g ==\n */"
method_declaration (+1495 nodes collapsed)
method_declaration (+62 nodes collapsed)
block_comment "/**\n * Try to evaluate String.indexOf/lastIndexOf:\n * "...
method_declaration (+485 nodes collapsed)
block_comment "/**\n * Try to fold an array join: ['a', 'b', 'c'].join('')"...
method_declaration (+881 nodes collapsed)
block_comment "/**\n * Try to fold array-element. e.g [1, 2, 3][10];\n */"
method_declaration (+295 nodes collapsed)
block_comment "/**\n * Try to fold array-length. e.g [1, 2, 3].length ==> "...
method_declaration (+253 nodes collapsed)
} "}"