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–1038 unchanged (1038 lines)
1039 appendHexJavaScriptRepresentation(sb, c);
1040 }
1041 } else {
1042 // No charsetEncoder provided - pass straight latin characters
1043 // through, and escape the rest. Doing the explicit character
1044 // check is measurably faster than using the CharsetEncoder.
1045 if (c > 0x1f && c <= 0x7f) {
1046 sb.append(c);
1047 } else {
1048 // Other characters can be misinterpreted by some js parsers,
1049 // or perhaps mangled by proxies along the way,
1050 // so we play it safe and unicode escape them.
1051 appendHexJavaScriptRepresentation(sb, c);
…lines 1052–1194 unchanged (143 lines)

After

…lines 1–1038 unchanged (1038 lines)
1039 appendHexJavaScriptRepresentation(sb, c);
1040 }
1041 } else {
1042 // No charsetEncoder provided - pass straight latin characters
1043 // through, and escape the rest. Doing the explicit character
1044 // check is measurably faster than using the CharsetEncoder.
1045 if (c > 0x1f && c < 0x7f) {
1046 sb.append(c);
1047 } else {
1048 // Other characters can be misinterpreted by some js parsers,
1049 // or perhaps mangled by proxies along the way,
1050 // so we play it safe and unicode escape them.
1051 appendHexJavaScriptRepresentation(sb, c);
…lines 1052–1194 unchanged (143 lines)

Before

program
block_comment "/*\n * Copyright 2004 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 "Charsets"
; ";"
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 "NodeUtil"
. "."
identifier "MatchNotFunction"
; ";"
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
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "TokenStream"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "IOException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "charset"
. "."
identifier "Charset"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "charset"
. "."
identifier "CharsetEncoder"
; ";"
block_comment "/**\n * CodeGenerator generates codes from a parse tree, send"...
class_declaration
class "class"
identifier "CodeGenerator"
class_body
{ "{"
field_declaration (+49 nodes collapsed)
field_declaration
modifiers
private "private"
final "final"
type_identifier "CodeConsumer"
variable_declarator
identifier "cc"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "CharsetEncoder"
variable_declarator
identifier "outputCharsetEncoder"
; ";"
constructor_declaration (+74 nodes collapsed)
constructor_declaration
identifier "CodeGenerator"
formal_parameters
( "("
formal_parameter
type_identifier "CodeConsumer"
identifier "consumer"
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
this "this"
argument_list
( "("
identifier "consumer"
, ","
null_literal "null"
) ")"
; ";"
} "}"
block_comment "/**\n * Insert a ECMASCRIPT 5 strict annotation.\n */"
method_declaration (+22 nodes collapsed)
method_declaration (+22 nodes collapsed)
method_declaration (+29 nodes collapsed)
method_declaration (+25 nodes collapsed)
method_declaration (+5213 nodes collapsed)
method_declaration (+95 nodes collapsed)
method_declaration (+70 nodes collapsed)
block_comment "/**\n * @return Whether the name is an indirect eval.\n */"
method_declaration (+64 nodes collapsed)
block_comment "/**\n * Adds a block or expression, substituting a VOID wit"...
method_declaration (+409 nodes collapsed)
block_comment "/**\n * @return Whether the Node is a DO or FUNCTION (with "...
method_declaration (+166 nodes collapsed)
block_comment "/**\n * Adds a node at the left-hand side of an expression."...
method_declaration (+33 nodes collapsed)
method_declaration (+32 nodes collapsed)
method_declaration (+135 nodes collapsed)
method_declaration (+27 nodes collapsed)
method_declaration (+31 nodes collapsed)
method_declaration (+113 nodes collapsed)
block_comment "/**\n * This function adds a comma-separated list as is spe"...
method_declaration (+115 nodes collapsed)
method_declaration (+38 nodes collapsed)
method_declaration (+49 nodes collapsed)
block_comment "/** Outputs a js string, using the optimal (single/double) q"...
method_declaration (+208 nodes collapsed)
block_comment "/** Escapes regular expression */"
method_declaration (+46 nodes collapsed)
block_comment "/**\n * Escapes the given string to a double quoted (\") Jav"...
method_declaration (+44 nodes collapsed)
block_comment "/* If the user doesn't want to specify an output charset enc"...
method_declaration (+25 nodes collapsed)
block_comment "/** Helper to escape javascript string as well as regular ex"...
method_declaration
modifiers
static "static"
type_identifier "String"
identifier "strEscape"
formal_parameters (+27 nodes collapsed)
block
{ "{"
local_variable_declaration (+22 nodes collapsed)
expression_statement
method_invocation
identifier "sb"
. "."
identifier "append"
argument_list
( "("
identifier "quote"
) ")"
; ";"
for_statement
for "for"
( "("
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "i"
= "="
decimal_integer_literal "0"
; ";"
binary_expression
identifier "i"
< "<"
method_invocation
identifier "s"
. "."
identifier "length"
argument_list
( "("
) ")"
; ";"
update_expression
identifier "i"
++ "++"
) ")"
block
{ "{"
local_variable_declaration
integral_type
char "char"
variable_declarator
identifier "c"
= "="
method_invocation
identifier "s"
. "."
identifier "charAt"
argument_list
( "("
identifier "i"
) ")"
; ";"
switch_expression
switch "switch"
parenthesized_expression
( "("
identifier "c"
) ")"
switch_block
{ "{"
switch_block_statement_group (+22 nodes collapsed)
switch_block_statement_group (+22 nodes collapsed)
switch_block_statement_group (+22 nodes collapsed)
switch_block_statement_group (+22 nodes collapsed)
switch_block_statement_group
switch_label
case "case"
character_literal "'\\\\'"
: ":"
expression_statement
method_invocation
identifier "sb"
. "."
identifier "append"
argument_list
( "("
identifier "backslashEscape"
) ")"
; ";"
break_statement
break "break"
; ";"
switch_block_statement_group
switch_label
case "case"
character_literal "'\\\"'"
: ":"
expression_statement
method_invocation
identifier "sb"
. "."
identifier "append"
argument_list
( "("
identifier "doublequoteEscape"
) ")"
; ";"
break_statement
break "break"
; ";"
switch_block_statement_group
switch_label
case "case"
character_literal "'\\''"
: ":"
expression_statement
method_invocation
identifier "sb"
. "."
identifier "append"
argument_list
( "("
identifier "singlequoteEscape"
) ")"
; ";"
break_statement
break "break"
; ";"
switch_block_statement_group (+122 nodes collapsed)
switch_block_statement_group (+143 nodes collapsed)
switch_block_statement_group
switch_label
default "default"
: ":"
line_comment "// If we're given an outputCharsetEncoder, then check if the"
line_comment "// character can be represented in this character set."
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "outputCharsetEncoder"
!= "!="
null_literal "null"
) ")"
block (+44 nodes collapsed)
else "else"
block
{ "{"
line_comment "// No charsetEncoder provided - pass straight latin characte"...
line_comment "// through, and escape the rest. Doing the explicit charact"...
line_comment "// check is measurably faster than using the CharsetEncoder."
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "c"
> ">"
hex_integer_literal "0x1f"
&& "&&"
binary_expression
identifier "c"
<= "<="
hex_integer_literal "0x7f"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "sb"
. "."
identifier "append"
argument_list
( "("
identifier "c"
) ")"
; ";"
} "}"
else "else"
block
{ "{"
line_comment "// Other characters can be misinterpreted by some js parsers"...
line_comment "// or perhaps mangled by proxies along the way,"
line_comment "// so we play it safe and unicode escape them."
expression_statement
method_invocation
identifier "appendHexJavaScriptRepresentation"
argument_list
( "("
identifier "sb"
, ","
identifier "c"
) ")"
; ";"
} "}"
} "}"
} "}"
} "}"
expression_statement
method_invocation
identifier "sb"
. "."
identifier "append"
argument_list
( "("
identifier "quote"
) ")"
; ";"
return_statement
return "return"
method_invocation
identifier "sb"
. "."
identifier "toString"
argument_list
( "("
) ")"
; ";"
} "}"
method_declaration (+147 nodes collapsed)
block_comment "/**\n * @param maxCount The maximum number of children to l"...
method_declaration (+139 nodes collapsed)
block_comment "/** Gets the first non-empty child of the given node. */"
method_declaration (+129 nodes collapsed)
line_comment "// Information on the current context. Used for disambiguati"...
line_comment "// For example, a \"{\" could indicate the start of an object "...
line_comment "// block, depending on the current context."
enum_declaration (+27 nodes collapsed)
method_declaration (+35 nodes collapsed)
block_comment "/**\n * If we're in a IN_FOR_INIT_CLAUSE, we can't permit i"...
method_declaration (+38 nodes collapsed)
block_comment "/**\n * If we're in a IN_FOR_INIT_CLAUSE, (and thus can't p"...
method_declaration (+35 nodes collapsed)
block_comment "/**\n * @see #appendHexJavaScriptRepresentation(int, Append"...
method_declaration (+57 nodes collapsed)
block_comment "/**\n * Returns a javascript representation of the characte"...
method_declaration (+181 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2004 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 "Charsets"
; ";"
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 "NodeUtil"
. "."
identifier "MatchNotFunction"
; ";"
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
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "TokenStream"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "IOException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "charset"
. "."
identifier "Charset"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "charset"
. "."
identifier "CharsetEncoder"
; ";"
block_comment "/**\n * CodeGenerator generates codes from a parse tree, send"...
class_declaration
class "class"
identifier "CodeGenerator"
class_body
{ "{"
field_declaration (+49 nodes collapsed)
field_declaration
modifiers
private "private"
final "final"
type_identifier "CodeConsumer"
variable_declarator
identifier "cc"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "CharsetEncoder"
variable_declarator
identifier "outputCharsetEncoder"
; ";"
constructor_declaration (+74 nodes collapsed)
constructor_declaration
identifier "CodeGenerator"
formal_parameters
( "("
formal_parameter
type_identifier "CodeConsumer"
identifier "consumer"
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
this "this"
argument_list
( "("
identifier "consumer"
, ","
null_literal "null"
) ")"
; ";"
} "}"
block_comment "/**\n * Insert a ECMASCRIPT 5 strict annotation.\n */"
method_declaration (+22 nodes collapsed)
method_declaration (+22 nodes collapsed)
method_declaration (+29 nodes collapsed)
method_declaration (+25 nodes collapsed)
method_declaration (+5213 nodes collapsed)
method_declaration (+95 nodes collapsed)
method_declaration (+70 nodes collapsed)
block_comment "/**\n * @return Whether the name is an indirect eval.\n */"
method_declaration (+64 nodes collapsed)
block_comment "/**\n * Adds a block or expression, substituting a VOID wit"...
method_declaration (+409 nodes collapsed)
block_comment "/**\n * @return Whether the Node is a DO or FUNCTION (with "...
method_declaration (+166 nodes collapsed)
block_comment "/**\n * Adds a node at the left-hand side of an expression."...
method_declaration (+33 nodes collapsed)
method_declaration (+32 nodes collapsed)
method_declaration (+135 nodes collapsed)
method_declaration (+27 nodes collapsed)
method_declaration (+31 nodes collapsed)
method_declaration (+113 nodes collapsed)
block_comment "/**\n * This function adds a comma-separated list as is spe"...
method_declaration (+115 nodes collapsed)
method_declaration (+38 nodes collapsed)
method_declaration (+49 nodes collapsed)
block_comment "/** Outputs a js string, using the optimal (single/double) q"...
method_declaration (+208 nodes collapsed)
block_comment "/** Escapes regular expression */"
method_declaration (+46 nodes collapsed)
block_comment "/**\n * Escapes the given string to a double quoted (\") Jav"...
method_declaration (+44 nodes collapsed)
block_comment "/* If the user doesn't want to specify an output charset enc"...
method_declaration (+25 nodes collapsed)
block_comment "/** Helper to escape javascript string as well as regular ex"...
method_declaration
modifiers
static "static"
type_identifier "String"
identifier "strEscape"
formal_parameters (+27 nodes collapsed)
block
{ "{"
local_variable_declaration (+22 nodes collapsed)
expression_statement
method_invocation
identifier "sb"
. "."
identifier "append"
argument_list
( "("
identifier "quote"
) ")"
; ";"
for_statement
for "for"
( "("
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "i"
= "="
decimal_integer_literal "0"
; ";"
binary_expression
identifier "i"
< "<"
method_invocation
identifier "s"
. "."
identifier "length"
argument_list
( "("
) ")"
; ";"
update_expression
identifier "i"
++ "++"
) ")"
block
{ "{"
local_variable_declaration
integral_type
char "char"
variable_declarator
identifier "c"
= "="
method_invocation
identifier "s"
. "."
identifier "charAt"
argument_list
( "("
identifier "i"
) ")"
; ";"
switch_expression
switch "switch"
parenthesized_expression
( "("
identifier "c"
) ")"
switch_block
{ "{"
switch_block_statement_group (+22 nodes collapsed)
switch_block_statement_group (+22 nodes collapsed)
switch_block_statement_group (+22 nodes collapsed)
switch_block_statement_group (+22 nodes collapsed)
switch_block_statement_group
switch_label
case "case"
character_literal "'\\\\'"
: ":"
expression_statement
method_invocation
identifier "sb"
. "."
identifier "append"
argument_list
( "("
identifier "backslashEscape"
) ")"
; ";"
break_statement
break "break"
; ";"
switch_block_statement_group
switch_label
case "case"
character_literal "'\\\"'"
: ":"
expression_statement
method_invocation
identifier "sb"
. "."
identifier "append"
argument_list
( "("
identifier "doublequoteEscape"
) ")"
; ";"
break_statement
break "break"
; ";"
switch_block_statement_group
switch_label
case "case"
character_literal "'\\''"
: ":"
expression_statement
method_invocation
identifier "sb"
. "."
identifier "append"
argument_list
( "("
identifier "singlequoteEscape"
) ")"
; ";"
break_statement
break "break"
; ";"
switch_block_statement_group (+122 nodes collapsed)
switch_block_statement_group (+143 nodes collapsed)
switch_block_statement_group
switch_label
default "default"
: ":"
line_comment "// If we're given an outputCharsetEncoder, then check if the"
line_comment "// character can be represented in this character set."
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "outputCharsetEncoder"
!= "!="
null_literal "null"
) ")"
block (+44 nodes collapsed)
else "else"
block
{ "{"
line_comment "// No charsetEncoder provided - pass straight latin characte"...
line_comment "// through, and escape the rest. Doing the explicit charact"...
line_comment "// check is measurably faster than using the CharsetEncoder."
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "c"
> ">"
hex_integer_literal "0x1f"
&& "&&"
binary_expression
identifier "c"
< "<"
hex_integer_literal "0x7f"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "sb"
. "."
identifier "append"
argument_list
( "("
identifier "c"
) ")"
; ";"
} "}"
else "else"
block
{ "{"
line_comment "// Other characters can be misinterpreted by some js parsers"...
line_comment "// or perhaps mangled by proxies along the way,"
line_comment "// so we play it safe and unicode escape them."
expression_statement
method_invocation
identifier "appendHexJavaScriptRepresentation"
argument_list
( "("
identifier "sb"
, ","
identifier "c"
) ")"
; ";"
} "}"
} "}"
} "}"
} "}"
expression_statement
method_invocation
identifier "sb"
. "."
identifier "append"
argument_list
( "("
identifier "quote"
) ")"
; ";"
return_statement
return "return"
method_invocation
identifier "sb"
. "."
identifier "toString"
argument_list
( "("
) ")"
; ";"
} "}"
method_declaration (+147 nodes collapsed)
block_comment "/**\n * @param maxCount The maximum number of children to l"...
method_declaration (+139 nodes collapsed)
block_comment "/** Gets the first non-empty child of the given node. */"
method_declaration (+129 nodes collapsed)
line_comment "// Information on the current context. Used for disambiguati"...
line_comment "// For example, a \"{\" could indicate the start of an object "...
line_comment "// block, depending on the current context."
enum_declaration (+27 nodes collapsed)
method_declaration (+35 nodes collapsed)
block_comment "/**\n * If we're in a IN_FOR_INIT_CLAUSE, we can't permit i"...
method_declaration (+38 nodes collapsed)
block_comment "/**\n * If we're in a IN_FOR_INIT_CLAUSE, (and thus can't p"...
method_declaration (+35 nodes collapsed)
block_comment "/**\n * @see #appendHexJavaScriptRepresentation(int, Append"...
method_declaration (+57 nodes collapsed)
block_comment "/**\n * Returns a javascript representation of the characte"...
method_declaration (+181 nodes collapsed)
} "}"