class_body
{ "{"
field_declaration (+22 nodes collapsed)
field_declaration (+22 nodes collapsed)
field_declaration (+22 nodes collapsed)
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "CodeGenerator"
variable_declarator
identifier "REGEXP_ESCAPER"
= "="
method_invocation
identifier "CodeGenerator"
. "."
identifier "forCostEstimation"
argument_list
( "("
null_literal "null"
block_comment "/* blow up if we try to produce code */"
) ")"
; ";"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "late"
; ";"
field_declaration
modifiers
private "private"
final "final"
integral_type
int "int"
variable_declarator
identifier "STRING_SPLIT_OVERHEAD"
= "="
method_invocation
string_literal
" "\""
string_fragment ".split('.')"
" "\""
. "."
identifier "length"
argument_list
( "("
) ")"
; ";"
field_declaration (+25 nodes collapsed)
field_declaration (+57 nodes collapsed)
block_comment "/**\n * @param late When late is false, this mean we are cu"...
constructor_declaration
identifier "PeepholeSubstituteAlternateSyntax"
formal_parameters
( "("
formal_parameter
boolean_type "boolean"
identifier "late"
) ")"
constructor_body
{ "{"
expression_statement
assignment_expression
field_access
this "this"
. "."
identifier "late"
= "="
identifier "late"
; ";"
} "}"
block_comment "/**\n * Tries apply our various peephole minimizations on t"...
method_declaration (+583 nodes collapsed)
method_declaration (+318 nodes collapsed)
method_declaration (+207 nodes collapsed)
method_declaration (+276 nodes collapsed)
method_declaration (+71 nodes collapsed)
method_declaration (+185 nodes collapsed)
block_comment "/**\n * Use \"return x?1:2;\" in place of \"if(x)return 1;retu"...
method_declaration (+621 nodes collapsed)
method_declaration (+115 nodes collapsed)
block_comment "/**\n * Use \"void 0\" in place of \"undefined\"\n */"
method_declaration (+97 nodes collapsed)
block_comment "/**\n * Reduce \"return undefined\" or \"return void 0\" to sim"...
method_declaration (+173 nodes collapsed)
block_comment "/**\n * Replace duplicate exits in control structures. If "...
method_declaration (+278 nodes collapsed)
block_comment "/**\n * Remove duplicate exits. If the node following the "...
method_declaration (+178 nodes collapsed)
block_comment "/**\n * @return Whether the expression does not produces an"...
method_declaration (+44 nodes collapsed)
block_comment "/**\n * @return n or the node following any following final"...
method_declaration (+59 nodes collapsed)
block_comment "/**\n * Check whether one exit can be replaced with another"...
method_declaration (+56 nodes collapsed)
method_declaration (+80 nodes collapsed)
method_declaration (+23 nodes collapsed)
block_comment "/**\n * Try to minimize NOT nodes such as !(x==y).\n *\n "...
method_declaration (+197 nodes collapsed)
block_comment "/**\n * Try turning IF nodes into smaller HOOKs\n *\n * R"...
method_declaration
modifiers
private "private"
type_identifier "Node"
identifier "tryMinimizeIf"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "n"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "parent"
= "="
method_invocation
identifier "n"
. "."
identifier "getParent"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "cond"
= "="
method_invocation
identifier "n"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
block_comment "/* If the condition is a literal, we'll let other\n * opt"...
if_statement (+22 nodes collapsed)
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "thenBranch"
= "="
method_invocation
identifier "cond"
. "."
identifier "getNext"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "elseBranch"
= "="
method_invocation
identifier "thenBranch"
. "."
identifier "getNext"
argument_list
( "("
) ")"
; ";"
if_statement (+514 nodes collapsed)
block_comment "/* TODO(dcc) This modifies the siblings of n, which is undes"...
expression_statement
method_invocation
identifier "tryRemoveRepeatedStatements"
argument_list
( "("
identifier "n"
) ")"
; ";"
line_comment "// if(!x)foo();else bar(); -> if(x)bar();else foo();"
line_comment "// An additional set of curly braces isn't worth it."
if_statement (+74 nodes collapsed)
line_comment "// if(x)return 1;else return 2; -> return x?1:2;"
if_statement (+132 nodes collapsed)
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "thenBranchIsExpressionBlock"
= "="
method_invocation
identifier "isFoldableExpressBlock"
argument_list
( "("
identifier "thenBranch"
) ")"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "elseBranchIsExpressionBlock"
= "="
method_invocation
identifier "isFoldableExpressBlock"
argument_list
( "("
identifier "elseBranch"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "thenBranchIsExpressionBlock"
&& "&&"
identifier "elseBranchIsExpressionBlock"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "thenOp"
= "="
method_invocation
method_invocation
identifier "getBlockExpression"
argument_list
( "("
identifier "thenBranch"
) ")"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "elseOp"
= "="
method_invocation
method_invocation
identifier "getBlockExpression"
argument_list
( "("
identifier "elseBranch"
) ")"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "thenOp"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
method_invocation
identifier "elseOp"
. "."
identifier "getType"
argument_list
( "("
) ")"
) ")"
block
{ "{"
line_comment "// if(x)a=1;else a=2; -> a=x?1:2;"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "NodeUtil"
. "."
identifier "isAssignmentOp"
argument_list
( "("
identifier "thenOp"
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "lhs"
= "="
method_invocation
identifier "thenOp"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression any 1:2
method_invocation
identifier "areNodesEqualForInlining"
argument_list
( "("
identifier "lhs"
, ","
method_invocation
identifier "elseOp"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
) ")"
&& "&&"
line_comment "// if LHS has side effects, don't proceed [since the optimiz"...
line_comment "// evaluates LHS before cond]"
line_comment "// NOTE - there are some circumstances where we can"
line_comment "// proceed even if there are side effects..."
unary_expression
! "!"
method_invocation
identifier "mayEffectMutableState"
argument_list
( "("
identifier "lhs"
) ")"
) ")"
block (+154 nodes collapsed)
} "}"
} "}"
line_comment "// if(x)foo();else bar(); -> x?foo():bar()"
expression_statement
method_invocation
identifier "n"
. "."
identifier "removeChild"
argument_list
( "("
identifier "cond"
) ")"
; ";"
expression_statement
method_invocation
identifier "thenOp"
. "."
identifier "detachFromParent"
argument_list
( "("
) ")"
; ";"
expression_statement
method_invocation
identifier "elseOp"
. "."
identifier "detachFromParent"
argument_list
( "("
) ")"
; ";"
local_variable_declaration (+32 nodes collapsed)
expression_statement
method_invocation
identifier "parent"
. "."
identifier "replaceChild"
argument_list
( "("
identifier "n"
, ","
identifier "expr"
) ")"
; ";"
expression_statement
method_invocation
identifier "reportCodeChange"
argument_list
( "("
) ")"
; ";"
return_statement
return "return"
identifier "expr"
; ";"
} "}"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "thenBranchIsVar"
= "="
method_invocation
identifier "isVarBlock"
argument_list
( "("
identifier "thenBranch"
) ")"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "elseBranchIsVar"
= "="
method_invocation
identifier "isVarBlock"
argument_list
( "("
identifier "elseBranch"
) ")"
; ";"
line_comment "// if(x)var y=1;else y=2 -> var y=x?1:2"
if_statement (+486 nodes collapsed)
return_statement
return "return"
identifier "n"
; ";"
} "}"
block_comment "/**\n * Try to remove duplicate statements from IF blocks. "...
method_declaration (+230 nodes collapsed)
block_comment "/**\n * @return Whether the node is a block with a single s"...
method_declaration (+196 nodes collapsed)
block_comment "/**\n * @return The expression node.\n */"
method_declaration (+39 nodes collapsed)
block_comment "/**\n * @return Whether the node is a block with a single s"...
method_declaration (+71 nodes collapsed)
block_comment "/**\n * @return Whether the node is a block with a single s"...
method_declaration (+86 nodes collapsed)
block_comment "/**\n * @return Whether the node is a single return stateme"...
method_declaration (+43 nodes collapsed)
block_comment "/**\n * @return The expression that is part of the return.\n"...
method_declaration (+45 nodes collapsed)
block_comment "/**\n * @return Whether the node is a block with a single s"...
method_declaration (+86 nodes collapsed)
block_comment "/**\n * @return The var node.\n */"
method_declaration (+39 nodes collapsed)
block_comment "/**\n * Does a statement consume a 'dangling else'? A state"...
method_declaration (+131 nodes collapsed)
block_comment "/**\n * Does the expression contain an operator with lower "...
method_declaration (+98 nodes collapsed)
block_comment "/**\n * Whether the node type has lower precedence than \"pr"...
method_declaration (+41 nodes collapsed)
block_comment "/**\n * Whether the node type has higher precedence than \"p"...
method_declaration (+41 nodes collapsed)
block_comment "/**\n * Does the expression contain a property assignment?\n"...
method_declaration (+99 nodes collapsed)
block_comment "/**\n * Try to minimize conditions expressions, as there ar"...
method_declaration (+1242 nodes collapsed)
block_comment "/**\n * Replaces a node with a number node if the new numbe"...
method_declaration (+82 nodes collapsed)
field_declaration (+44 nodes collapsed)
block_comment "/**\n * Fold \"new Object()\" to \"Object()\".\n */"
method_declaration (+141 nodes collapsed)
block_comment "/**\n * Replaces a new Array or Object node with an object "...
method_declaration (+350 nodes collapsed)
enum_declaration
modifiers
private "private"
static "static"
enum "enum"
identifier "FoldArrayAction"
enum_body
{ "{"
enum_constant
identifier "NOT_SAFE_TO_FOLD"
, ","
enum_constant
identifier "SAFE_TO_FOLD_WITH_ARGS"
, ","
enum_constant
identifier "SAFE_TO_FOLD_WITHOUT_ARGS"
} "}"
block_comment "/**\n * Checks if it is safe to fold Array() constructor in"...
method_declaration (+181 nodes collapsed)
method_declaration (+400 nodes collapsed)
method_declaration (+98 nodes collapsed)
method_declaration (+105 nodes collapsed)
method_declaration (+302 nodes collapsed)
block_comment "/**\n * Find a delimiter that does not occur in the given s"...
method_declaration (+200 nodes collapsed)
field_declaration (+21 nodes collapsed)
block_comment "/**\n * are the given flags valid regular expression flags?"...
method_declaration (+32 nodes collapsed)
block_comment "/**\n * are the given flags safe to fold?\n * We don't fol"...
method_declaration (+35 nodes collapsed)
block_comment "/**\n * returns a string node that can safely be rendered i"...
method_declaration (+550 nodes collapsed)
block_comment "/**\n * true if the JavaScript string would contain a Unico"...
method_declaration (+147 nodes collapsed)
} "}"