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–702 unchanged (702 lines)
703
704 /**
705 * @return Whether the Node is a DO or FUNCTION (with or without
706 * labels).
707 */
708 private boolean isOneExactlyFunctionOrDo(Node n) {
709 // For labels with block children, we need to ensure that a
710 // labeled FUNCTION or DO isn't generated when extraneous BLOCKs
711 // are skipped.
712 // Either a empty statement or an block with more than one child,
713 // way it isn't a FUNCTION or DO.
714 return (n.getType() == Token.FUNCTION || n.getType() == Token.DO);
715 }
716
717 /**
718 * Adds a node at the left-hand side of an expression. Unlike
719 * {@link #addExpr(Node,int)}, this preserves information about the context.
720 *
721 * The left side of an expression is special because in the JavaScript
…lines 722–1050 unchanged (329 lines)

After

…lines 1–702 unchanged (702 lines)
703
704 /**
705 * @return Whether the Node is a DO or FUNCTION (with or without
706 * labels).
707 */
708 private boolean isOneExactlyFunctionOrDo(Node n) {
709 if (n.getType() == Token.LABEL) {
710 Node labeledStatement = n.getLastChild();
711 if (labeledStatement.getType() != Token.BLOCK) {
712 return isOneExactlyFunctionOrDo(labeledStatement);
713 } else {
714 // For labels with block children, we need to ensure that a
715 // labeled FUNCTION or DO isn't generated when extraneous BLOCKs
716 // are skipped.
717 if (getNonEmptyChildCount(n, 2) == 1) {
718 return isOneExactlyFunctionOrDo(getFirstNonEmptyChild(n));
719 } else {
720 // Either a empty statement or an block with more than one child,
721 // way it isn't a FUNCTION or DO.
722 return false;
723 }
724 }
725 } else {
726 return (n.getType() == Token.FUNCTION || n.getType() == Token.DO);
727 }
728 }
729
730 /**
731 * Adds a node at the left-hand side of an expression. Unlike
732 * {@link #addExpr(Node,int)}, this preserves information about the context.
733 *
…lines 734–1063 unchanged (330 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 "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
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"
) ")"
; ";"
} "}"
method_declaration (+22 nodes collapsed)
method_declaration (+29 nodes collapsed)
method_declaration (+25 nodes collapsed)
method_declaration (+4565 nodes collapsed)
block_comment "/**\n * Adds a block or expression, substituting a VOID wit"...
method_declaration (+388 nodes collapsed)
block_comment "/**\n * @return Whether the Node is a DO or FUNCTION (with "...
method_declaration
modifiers
private "private"
boolean_type "boolean"
identifier "isOneExactlyFunctionOrDo"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "n"
) ")"
block
{ "{"
line_comment "// For labels with block children, we need to ensure that a"
line_comment "// labeled FUNCTION or DO isn't generated when extraneous BL"...
line_comment "// are skipped. "
line_comment "// Either a empty statement or an block with more than one c"...
line_comment "// way it isn't a FUNCTION or DO."
return_statement (+34 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 (+165 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 (+565 nodes collapsed)
method_declaration (+147 nodes collapsed)
block_comment "/**\n * @param maxCount The maximum number of children to l"...
method_declaration (+101 nodes collapsed)
block_comment "/** Gets the first non-empty child of the given node. */"
method_declaration (+79 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 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 "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
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"
) ")"
; ";"
} "}"
method_declaration (+22 nodes collapsed)
method_declaration (+29 nodes collapsed)
method_declaration (+25 nodes collapsed)
method_declaration (+4565 nodes collapsed)
block_comment "/**\n * Adds a block or expression, substituting a VOID wit"...
method_declaration (+388 nodes collapsed)
block_comment "/**\n * @return Whether the Node is a DO or FUNCTION (with "...
method_declaration
modifiers
private "private"
boolean_type "boolean"
identifier "isOneExactlyFunctionOrDo"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "n"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "n"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "LABEL"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "labeledStatement"
= "="
method_invocation
identifier "n"
. "."
identifier "getLastChild"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "labeledStatement"
. "."
identifier "getType"
argument_list
( "("
) ")"
!= "!="
field_access
identifier "Token"
. "."
identifier "BLOCK"
) ")"
block
{ "{"
return_statement
return "return"
method_invocation
identifier "isOneExactlyFunctionOrDo"
argument_list
( "("
identifier "labeledStatement"
) ")"
; ";"
} "}"
else "else"
block
{ "{"
line_comment "// For labels with block children, we need to ensure that a"
line_comment "// labeled FUNCTION or DO isn't generated when extraneous BL"...
line_comment "// are skipped. "
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "getNonEmptyChildCount"
argument_list
( "("
identifier "n"
, ","
decimal_integer_literal "2"
) ")"
== "=="
decimal_integer_literal "1"
) ")"
block
{ "{"
return_statement
return "return"
method_invocation
identifier "isOneExactlyFunctionOrDo"
argument_list
( "("
method_invocation
identifier "getFirstNonEmptyChild"
argument_list
( "("
identifier "n"
) ")"
) ")"
; ";"
} "}"
else "else"
block
{ "{"
line_comment "// Either a empty statement or an block with more than one c"...
line_comment "// way it isn't a FUNCTION or DO."
return_statement
return "return"
false "false"
; ";"
} "}"
} "}"
} "}"
else "else"
block
{ "{"
return_statement (+34 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 (+165 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 (+565 nodes collapsed)
method_declaration (+147 nodes collapsed)
block_comment "/**\n * @param maxCount The maximum number of children to l"...
method_declaration (+101 nodes collapsed)
block_comment "/** Gets the first non-empty child of the given node. */"
method_declaration (+79 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)
} "}"