class_body
{ "{"
field_declaration
modifiers
private "private"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
line_comment "// Use an array here for faster iteration compared to Immuta"...
field_declaration
modifiers
private "private"
final "final"
array_type
type_identifier "AbstractPeepholeOptimization"
dimensions
[ "["
] "]"
variable_declarator
identifier "peepholeOptimizations"
; ";"
line_comment "// Track whether the a scope has been modified so that it ca"...
line_comment "// immediately."
field_declaration
modifiers
private "private"
type_identifier "StateStack"
variable_declarator
identifier "traversalState"
= "="
object_creation_expression
new "new"
type_identifier "StateStack"
argument_list
( "("
) ")"
; ";"
class_declaration (+55 nodes collapsed)
class_declaration (+163 nodes collapsed)
class_declaration (+41 nodes collapsed)
block_comment "/**\n * Creates a peephole optimization pass that runs the "...
constructor_declaration (+35 nodes collapsed)
method_declaration
modifiers
public "public"
type_identifier "AbstractCompiler"
identifier "getCompiler"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "compiler"
; ";"
} "}"
method_declaration (+75 nodes collapsed)
method_declaration
modifiers
private "private"
void_type "void"
identifier "traverse"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "node"
) ")"
block
{ "{"
line_comment "// The goal here is to avoid retraversing"
line_comment "// the entire AST to catch newly created opportunities."
line_comment "// So we track whether a \"unit of code\" has changed,"
line_comment "// and revisit immediately."
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
method_invocation
identifier "shouldVisit"
argument_list
( "("
identifier "node"
) ")"
) ")"
block
{ "{"
return_statement
return "return"
; ";"
} "}"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "visits"
= "="
decimal_integer_literal "0"
; ";"
do_statement
do "do"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "c"
= "="
method_invocation
identifier "node"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
while_statement
while "while"
parenthesized_expression
( "("
binary_expression
identifier "c"
!= "!="
null_literal "null"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "traverse"
argument_list
( "("
identifier "c"
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "next"
= "="
method_invocation
identifier "c"
. "."
identifier "getNext"
argument_list
( "("
) ")"
; ";"
expression_statement
assignment_expression
identifier "c"
= "="
identifier "next"
; ";"
} "}"
expression_statement
method_invocation
identifier "visit"
argument_list
( "("
identifier "node"
) ")"
; ";"
expression_statement
update_expression
identifier "visits"
++ "++"
; ";"
expression_statement
method_invocation
identifier "Preconditions"
. "."
identifier "checkState"
argument_list
( "("
binary_expression
identifier "visits"
< "<"
decimal_integer_literal "10000"
, ","
string_literal
" "\""
string_fragment "too many interations"
" "\""
) ")"
; ";"
} "}"
while "while"
parenthesized_expression
( "("
method_invocation
identifier "shouldRetraverse"
argument_list
( "("
identifier "node"
) ")"
) ")"
; ";"
expression_statement
method_invocation
identifier "exitNode"
argument_list
( "("
identifier "node"
) ")"
; ";"
} "}"
method_declaration (+105 nodes collapsed)
method_declaration (+82 nodes collapsed)
method_declaration (+47 nodes collapsed)
method_declaration (+109 nodes collapsed)
block_comment "/**\n * Make sure that all the optimizations have the curre"...
method_declaration (+32 nodes collapsed)
method_declaration (+32 nodes collapsed)
} "}"