public class DuplicateExecuteOnceRemover extends JsModVisitor
didChange
LVALUE_CONTEXT, UNMODIFIABLE_CONTEXT
Constructor and Description |
---|
DuplicateExecuteOnceRemover(JsProgram program) |
DuplicateExecuteOnceRemover(JsProgram program,
Set<JsFunction> alreadyCalled) |
Modifier and Type | Method and Description |
---|---|
static OptimizerStats |
exec(JsProgram program)
Static entry point used by JavaToJavaScriptCompiler.
|
boolean |
visit(JsBinaryOperation x,
JsContext ctx)
Look for comma expressions that contain duplicate calls and handle the
conditional-evaluation case of logical and/or operations.
|
boolean |
visit(JsBlock x,
JsContext ctx)
Most of the branching statements (as well as JsFunctions) will visit with
a JsBlock, so we don't need to explicitly enumerate all JsStatement
subtypes.
|
boolean |
visit(JsCase x,
JsContext ctx) |
boolean |
visit(JsConditional x,
JsContext ctx) |
boolean |
visit(JsDefault x,
JsContext ctx) |
boolean |
visit(JsExprStmt x,
JsContext ctx) |
boolean |
visit(JsForIn x,
JsContext ctx) |
boolean |
visit(JsFor x,
JsContext ctx) |
boolean |
visit(JsIf x,
JsContext ctx) |
boolean |
visit(JsInvocation x,
JsContext ctx)
Possibly record that we've seen a call in the current context.
|
boolean |
visit(JsWhile x,
JsContext ctx) |
checkReplacement, didChange, doAccept, doAcceptList, doAcceptLvalue, doAcceptWithInsertRemove
accept, acceptList, acceptLvalue, acceptWithInsertRemove, doTraverse, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, endVisit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
public DuplicateExecuteOnceRemover(JsProgram program)
public DuplicateExecuteOnceRemover(JsProgram program, Set<JsFunction> alreadyCalled)
public boolean visit(JsBinaryOperation x, JsContext ctx)
public boolean visit(JsBlock x, JsContext ctx)
public boolean visit(JsConditional x, JsContext ctx)
public boolean visit(JsExprStmt x, JsContext ctx)
public boolean visit(JsInvocation x, JsContext ctx)
public static OptimizerStats exec(JsProgram program)
Copyright © 2018. All rights reserved.