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–273 unchanged (273 lines)
274 n.setType(Token.FOR);
275 n.addChildBefore(new Node(Token.EMPTY), expr);
276 n.addChildAfter(new Node(Token.EMPTY), expr);
277 reportCodeChange("WHILE node");
278 }
279 break;
280
281 }
282 }
283
284 /**
285 * Rewrite named unhoisted functions declarations to a known
286 * consistent behavior so we don't to different logic paths for the same
287 * code. From:
288 * function f() {}
289 * to:
290 * var f = function () {};
291 */
292
293 /**
294 * Rewrite the function declaration from:
295 * function x() {}
296 * FUNCTION
297 * NAME
298 * LP
…lines 299–302 unchanged (4 lines)
303 * NAME
304 * FUNCTION
305 * NAME (w/ empty string)
306 * LP
307 * BLOCK
308 */
309 // Prepare a spot for the function.
310
311 // Prepare the function
312
313 // Move the function
314
315
316 /**
317 * Do normalizations that introduce new siblings or parents.
318 */
319 private void doStatementNormalizations(
320 NodeTraversal t, Node n, Node parent) {
…lines 321–514 unchanged (194 lines)
515 */
516 @Override
517 public void onRedeclaration(
518 Scope s, String name, Node n, Node parent, Node gramps,
519 Node nodeWithLineNumber) {
520 Preconditions.checkState(n.getType() == Token.NAME);
521 if (parent.getType() == Token.VAR) {
522 // If name is "arguments", Var maybe null.
523 Preconditions.checkState(parent.hasOneChild());
524
525 replaceVarWithAssignment(n, parent, gramps);
526 }
527 }
528
529 /**
…lines 530–603 unchanged (74 lines)

After

…lines 1–274 unchanged (274 lines)
275 n.addChildBefore(new Node(Token.EMPTY), expr);
276 n.addChildAfter(new Node(Token.EMPTY), expr);
277 reportCodeChange("WHILE node");
278 }
279 break;
280
281 case Token.FUNCTION:
282 normalizeFunctionDeclaration(n);
283 break;
284 }
285 }
286
287 /**
288 * Rewrite named unhoisted functions declarations to a known
289 * consistent behavior so we don't to different logic paths for the same
290 * code. From:
291 * function f() {}
292 * to:
293 * var f = function () {};
294 */
295 private void normalizeFunctionDeclaration(Node n) {
296 Preconditions.checkState(n.getType() == Token.FUNCTION);
297 if (!NodeUtil.isFunctionAnonymous(n)
298 && !NodeUtil.isHoistedFunctionDeclaration(n)) {
299 rewriteFunctionDeclaration(n);
300 }
301 }
302
303 /**
304 * Rewrite the function declaration from:
305 * function x() {}
306 * FUNCTION
307 * NAME
…lines 308–312 unchanged (5 lines)
313 * NAME
314 * FUNCTION
315 * NAME (w/ empty string)
316 * LP
317 * BLOCK
318 */
319 private void rewriteFunctionDeclaration(Node n) {
320 // Prepare a spot for the function.
321 Node oldNameNode = n.getFirstChild();
322 Node fnNameNode = oldNameNode.cloneNode();
323 Node var = new Node(Token.VAR, fnNameNode, n.getLineno(), n.getCharno());
324 var.copyInformationFrom(n);
325
326 // Prepare the function
327 oldNameNode.setString("");
328
329 // Move the function
330 Node parent = n.getParent();
331 parent.replaceChild(n, var);
332 fnNameNode.addChildToFront(n);
333
334 reportCodeChange("Function declaration");
335 }
336
337 /**
338 * Do normalizations that introduce new siblings or parents.
339 */
340 private void doStatementNormalizations(
341 NodeTraversal t, Node n, Node parent) {
…lines 342–535 unchanged (194 lines)
536 */
537 @Override
538 public void onRedeclaration(
539 Scope s, String name, Node n, Node parent, Node gramps,
540 Node nodeWithLineNumber) {
541 Preconditions.checkState(n.getType() == Token.NAME);
542 Var v = s.getVar(name);
543 // If name is "arguments", Var maybe null.
544 Preconditions.checkState(
545 v == null || v.getParentNode().getType() != Token.CATCH);
546 if (v != null && parent.getType() == Token.FUNCTION) {
547 if (v.getParentNode().getType() == Token.VAR) {
548 s.undeclare(v);
549 s.declare(name, n, n.getJSType(), v.input);
550 replaceVarWithAssignment(v.getNameNode(), v.getParentNode(),
551 v.getParentNode().getParent());
552 }
553 } else if (parent.getType() == Token.VAR) {
554 Preconditions.checkState(parent.hasOneChild());
555
556 replaceVarWithAssignment(n, parent, gramps);
557 }
558 }
559
…lines 560–634 unchanged (75 lines)

Before

program
block_comment "/*\n * Copyright 2008 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 "common"
. "."
identifier "collect"
. "."
identifier "Maps"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "NodeTraversal"
. "."
identifier "AbstractPostOrderCallback"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "NodeTraversal"
. "."
identifier "Callback"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "Scope"
. "."
identifier "Var"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "JSDocInfo"
; ";"
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
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
block_comment "/**\n * The goal with this pass is to simplify the other pass"...
line_comment "// public for ReplaceDebugStringsTest"
class_declaration
class "class"
identifier "Normalize"
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"
; ";"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "assertOnChange"
; ";"
field_declaration
modifiers
private "private"
static "static"
final "final"
boolean_type "boolean"
variable_declarator
identifier "CONVERT_WHILE_TO_FOR"
= "="
true "true"
; ";"
field_declaration
modifiers
static "static"
final "final"
boolean_type "boolean"
variable_declarator
identifier "MAKE_LOCAL_NAMES_UNIQUE"
= "="
true "true"
; ";"
constructor_declaration (+33 nodes collapsed)
method_declaration (+49 nodes collapsed)
method_declaration (+133 nodes collapsed)
class_declaration (+372 nodes collapsed)
block_comment "/**\n * Walk the AST tree and verify that constant names ar"...
class_declaration (+585 nodes collapsed)
block_comment "/**\n * Simplify the AST:\n * - VAR declarations split, "...
class_declaration
modifiers
static "static"
class "class"
identifier "NormalizeStatements"
super_interfaces
implements "implements"
type_list
type_identifier "Callback"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "assertOnChange"
; ";"
constructor_declaration (+33 nodes collapsed)
method_declaration (+49 nodes collapsed)
method_declaration (+41 nodes collapsed)
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
public "public"
void_type "void"
identifier "visit"
formal_parameters
( "("
formal_parameter
type_identifier "NodeTraversal"
identifier "t"
, ","
formal_parameter
type_identifier "Node"
identifier "n"
, ","
formal_parameter
type_identifier "Node"
identifier "parent"
) ")"
block
{ "{"
switch_expression
switch "switch"
parenthesized_expression
( "("
method_invocation
identifier "n"
. "."
identifier "getType"
argument_list
( "("
) ")"
) ")"
switch_block
{ "{"
switch_block_statement_group (+99 nodes collapsed)
} "}"
} "}"
block_comment "/**\n * Rewrite named unhoisted functions declarations to"...
block_comment "/**\n * Rewrite the function declaration from:\n * f"...
line_comment "// Prepare a spot for the function."
line_comment "// Prepare the function"
line_comment "// Move the function"
block_comment "/**\n * Do normalizations that introduce new siblings or "...
method_declaration (+157 nodes collapsed)
line_comment "// TODO(johnlenz): Move this to NodeTypeNormalizer once the "...
line_comment "// fixed."
block_comment "/**\n * Limit the number of special cases where LABELs ne"...
method_declaration (+163 nodes collapsed)
block_comment "/**\n * Bring the initializers out of FOR loops. These n"...
method_declaration (+298 nodes collapsed)
block_comment "/**\n * Split a var node such as:\n * var a, b;\n "...
method_declaration (+216 nodes collapsed)
block_comment "/**\n * Move all the functions that are valid at the exec"...
method_declaration (+220 nodes collapsed)
block_comment "/**\n * @param after The child node to insert the newChil"...
method_declaration (+64 nodes collapsed)
} "}"
block_comment "/**\n * Remove duplicate VAR declarations.\n */"
method_declaration (+73 nodes collapsed)
block_comment "/**\n * ScopeCreator duplicate declaration handler.\n */"
class_declaration
modifiers
private "private"
final "final"
class "class"
identifier "DuplicateDeclarationHandler"
super_interfaces
implements "implements"
type_list
scoped_type_identifier
type_identifier "SyntacticScopeCreator"
. "."
type_identifier "RedeclarationHandler"
class_body
{ "{"
block_comment "/**\n * Remove duplicate VAR declarations encountered dis"...
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
public "public"
void_type "void"
identifier "onRedeclaration"
formal_parameters (+26 nodes collapsed)
block
{ "{"
expression_statement (+22 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "parent"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "VAR"
) ")"
block
{ "{"
line_comment "// If name is \"arguments\", Var maybe null."
expression_statement
method_invocation
identifier "Preconditions"
. "."
identifier "checkState"
argument_list
( "("
method_invocation
identifier "parent"
. "."
identifier "hasOneChild"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
method_invocation
identifier "replaceVarWithAssignment"
argument_list
( "("
identifier "n"
, ","
identifier "parent"
, ","
identifier "gramps"
) ")"
; ";"
} "}"
} "}"
block_comment "/**\n * Remove the parent VAR. There are three cases that"...
method_declaration (+251 nodes collapsed)
} "}"
block_comment "/**\n * A simple class that causes scope to be created.\n "...
class_declaration (+117 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2008 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 "common"
. "."
identifier "collect"
. "."
identifier "Maps"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "NodeTraversal"
. "."
identifier "AbstractPostOrderCallback"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "NodeTraversal"
. "."
identifier "Callback"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "Scope"
. "."
identifier "Var"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "JSDocInfo"
; ";"
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
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
block_comment "/**\n * The goal with this pass is to simplify the other pass"...
line_comment "// public for ReplaceDebugStringsTest"
class_declaration
class "class"
identifier "Normalize"
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"
; ";"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "assertOnChange"
; ";"
field_declaration
modifiers
private "private"
static "static"
final "final"
boolean_type "boolean"
variable_declarator
identifier "CONVERT_WHILE_TO_FOR"
= "="
true "true"
; ";"
field_declaration
modifiers
static "static"
final "final"
boolean_type "boolean"
variable_declarator
identifier "MAKE_LOCAL_NAMES_UNIQUE"
= "="
true "true"
; ";"
constructor_declaration (+33 nodes collapsed)
method_declaration (+49 nodes collapsed)
method_declaration (+133 nodes collapsed)
class_declaration (+372 nodes collapsed)
block_comment "/**\n * Walk the AST tree and verify that constant names ar"...
class_declaration (+585 nodes collapsed)
block_comment "/**\n * Simplify the AST:\n * - VAR declarations split, "...
class_declaration
modifiers
static "static"
class "class"
identifier "NormalizeStatements"
super_interfaces
implements "implements"
type_list
type_identifier "Callback"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "assertOnChange"
; ";"
constructor_declaration (+33 nodes collapsed)
method_declaration (+49 nodes collapsed)
method_declaration (+41 nodes collapsed)
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
public "public"
void_type "void"
identifier "visit"
formal_parameters
( "("
formal_parameter
type_identifier "NodeTraversal"
identifier "t"
, ","
formal_parameter
type_identifier "Node"
identifier "n"
, ","
formal_parameter
type_identifier "Node"
identifier "parent"
) ")"
block
{ "{"
switch_expression
switch "switch"
parenthesized_expression
( "("
method_invocation
identifier "n"
. "."
identifier "getType"
argument_list
( "("
) ")"
) ")"
switch_block
{ "{"
switch_block_statement_group (+99 nodes collapsed)
switch_block_statement_group
switch_label
case "case"
field_access
identifier "Token"
. "."
identifier "FUNCTION"
: ":"
expression_statement
method_invocation
identifier "normalizeFunctionDeclaration"
argument_list
( "("
identifier "n"
) ")"
; ";"
break_statement
break "break"
; ";"
} "}"
} "}"
block_comment "/**\n * Rewrite named unhoisted functions declarations to"...
method_declaration
modifiers
private "private"
void_type "void"
identifier "normalizeFunctionDeclaration"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "n"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "Preconditions"
. "."
identifier "checkState"
argument_list
( "("
binary_expression
method_invocation
identifier "n"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "FUNCTION"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
unary_expression
! "!"
method_invocation
identifier "NodeUtil"
. "."
identifier "isFunctionAnonymous"
argument_list
( "("
identifier "n"
) ")"
&& "&&"
unary_expression
! "!"
method_invocation
identifier "NodeUtil"
. "."
identifier "isHoistedFunctionDeclaration"
argument_list
( "("
identifier "n"
) ")"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "rewriteFunctionDeclaration"
argument_list
( "("
identifier "n"
) ")"
; ";"
} "}"
} "}"
block_comment "/**\n * Rewrite the function declaration from:\n * f"...
method_declaration
modifiers
private "private"
void_type "void"
identifier "rewriteFunctionDeclaration"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "n"
) ")"
block
{ "{"
line_comment "// Prepare a spot for the function."
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "oldNameNode"
= "="
method_invocation
identifier "n"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "fnNameNode"
= "="
method_invocation
identifier "oldNameNode"
. "."
identifier "cloneNode"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "var"
= "="
object_creation_expression
new "new"
type_identifier "Node"
argument_list
( "("
field_access
identifier "Token"
. "."
identifier "VAR"
, ","
identifier "fnNameNode"
, ","
method_invocation
identifier "n"
. "."
identifier "getLineno"
argument_list
( "("
) ")"
, ","
method_invocation
identifier "n"
. "."
identifier "getCharno"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
method_invocation
identifier "var"
. "."
identifier "copyInformationFrom"
argument_list
( "("
identifier "n"
) ")"
; ";"
line_comment "// Prepare the function"
expression_statement
method_invocation
identifier "oldNameNode"
. "."
identifier "setString"
argument_list
( "("
string_literal
" "\""
" "\""
) ")"
; ";"
line_comment "// Move the function"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "parent"
= "="
method_invocation
identifier "n"
. "."
identifier "getParent"
argument_list
( "("
) ")"
; ";"
expression_statement
method_invocation
identifier "parent"
. "."
identifier "replaceChild"
argument_list
( "("
identifier "n"
, ","
identifier "var"
) ")"
; ";"
expression_statement
method_invocation
identifier "fnNameNode"
. "."
identifier "addChildToFront"
argument_list
( "("
identifier "n"
) ")"
; ";"
expression_statement
method_invocation
identifier "reportCodeChange"
argument_list
( "("
string_literal
" "\""
string_fragment "Function declaration"
" "\""
) ")"
; ";"
} "}"
block_comment "/**\n * Do normalizations that introduce new siblings or "...
method_declaration (+157 nodes collapsed)
line_comment "// TODO(johnlenz): Move this to NodeTypeNormalizer once the "...
line_comment "// fixed."
block_comment "/**\n * Limit the number of special cases where LABELs ne"...
method_declaration (+163 nodes collapsed)
block_comment "/**\n * Bring the initializers out of FOR loops. These n"...
method_declaration (+298 nodes collapsed)
block_comment "/**\n * Split a var node such as:\n * var a, b;\n "...
method_declaration (+216 nodes collapsed)
block_comment "/**\n * Move all the functions that are valid at the exec"...
method_declaration (+220 nodes collapsed)
block_comment "/**\n * @param after The child node to insert the newChil"...
method_declaration (+64 nodes collapsed)
} "}"
block_comment "/**\n * Remove duplicate VAR declarations.\n */"
method_declaration (+73 nodes collapsed)
block_comment "/**\n * ScopeCreator duplicate declaration handler.\n */"
class_declaration
modifiers
private "private"
final "final"
class "class"
identifier "DuplicateDeclarationHandler"
super_interfaces
implements "implements"
type_list
scoped_type_identifier
type_identifier "SyntacticScopeCreator"
. "."
type_identifier "RedeclarationHandler"
class_body
{ "{"
block_comment "/**\n * Remove duplicate VAR declarations encountered dis"...
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
public "public"
void_type "void"
identifier "onRedeclaration"
formal_parameters (+26 nodes collapsed)
block
{ "{"
expression_statement (+22 nodes collapsed)
local_variable_declaration
type_identifier "Var"
variable_declarator
identifier "v"
= "="
method_invocation
identifier "s"
. "."
identifier "getVar"
argument_list
( "("
identifier "name"
) ")"
; ";"
line_comment "// If name is \"arguments\", Var maybe null."
expression_statement
method_invocation
identifier "Preconditions"
. "."
identifier "checkState"
argument_list
( "("
binary_expression
binary_expression
identifier "v"
== "=="
null_literal "null"
|| "||"
binary_expression
method_invocation
method_invocation
identifier "v"
. "."
identifier "getParentNode"
argument_list
( "("
) ")"
. "."
identifier "getType"
argument_list
( "("
) ")"
!= "!="
field_access
identifier "Token"
. "."
identifier "CATCH"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "v"
!= "!="
null_literal "null"
&& "&&"
binary_expression
method_invocation
identifier "parent"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "FUNCTION"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
method_invocation
identifier "v"
. "."
identifier "getParentNode"
argument_list
( "("
) ")"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "VAR"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "s"
. "."
identifier "undeclare"
argument_list
( "("
identifier "v"
) ")"
; ";"
expression_statement
method_invocation
identifier "s"
. "."
identifier "declare"
argument_list
( "("
identifier "name"
, ","
identifier "n"
, ","
method_invocation
identifier "n"
. "."
identifier "getJSType"
argument_list
( "("
) ")"
, ","
field_access
identifier "v"
. "."
identifier "input"
) ")"
; ";"
expression_statement
method_invocation
identifier "replaceVarWithAssignment"
argument_list
( "("
method_invocation
identifier "v"
. "."
identifier "getNameNode"
argument_list
( "("
) ")"
, ","
method_invocation
identifier "v"
. "."
identifier "getParentNode"
argument_list
( "("
) ")"
, ","
method_invocation
method_invocation
identifier "v"
. "."
identifier "getParentNode"
argument_list
( "("
) ")"
. "."
identifier "getParent"
argument_list
( "("
) ")"
) ")"
; ";"
} "}"
} "}"
else "else"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "parent"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "VAR"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "Preconditions"
. "."
identifier "checkState"
argument_list
( "("
method_invocation
identifier "parent"
. "."
identifier "hasOneChild"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
method_invocation
identifier "replaceVarWithAssignment"
argument_list
( "("
identifier "n"
, ","
identifier "parent"
, ","
identifier "gramps"
) ")"
; ";"
} "}"
} "}"
block_comment "/**\n * Remove the parent VAR. There are three cases that"...
method_declaration (+251 nodes collapsed)
} "}"
block_comment "/**\n * A simple class that causes scope to be created.\n "...
class_declaration (+117 nodes collapsed)
} "}"