public class JsStaticEval extends Object
Modifier and Type | Class and Description |
---|---|
static class |
JsStaticEval.FindBreakContinueStatementsVisitor
Examines code to find out whether it contains any break or continue
statements.
|
Constructor and Description |
---|
JsStaticEval(JsProgram program) |
Modifier and Type | Method and Description |
---|---|
static OptimizerStats |
exec(JsProgram program) |
static <T extends JsVisitable> |
exec(JsProgram program,
T node) |
OptimizerStats |
execImpl() |
<T extends JsVisitable> |
execImpl(T node) |
protected static JsExpression |
extractExpression(JsStatement stmt)
Attempts to extract a single expression from a given statement and returns
it.
|
protected static boolean |
isEmpty(JsStatement stmt) |
protected static JsFunction |
isFunctionDecl(JsStatement stmt)
If the statement is a JsExprStmt that declares a function with no other
side effects, returns that function; otherwise
null . |
protected static void |
shortCircuitAnd(JsExpression arg1,
JsExpression arg2,
JsContext ctx)
Simplify short circuit AND expressions.
|
protected static void |
shortCircuitOr(JsExpression arg1,
JsExpression arg2,
JsContext ctx)
Simplify short circuit OR expressions.
|
protected static void |
trySimplifyComma(JsExpression arg1,
JsExpression arg2,
JsContext ctx) |
public JsStaticEval(JsProgram program)
public static <T extends JsVisitable> T exec(JsProgram program, T node)
public static OptimizerStats exec(JsProgram program)
protected static JsExpression extractExpression(JsStatement stmt)
null
.protected static boolean isEmpty(JsStatement stmt)
protected static JsFunction isFunctionDecl(JsStatement stmt)
null
.protected static void shortCircuitAnd(JsExpression arg1, JsExpression arg2, JsContext ctx)
if (true && isWhatever()) -> if (isWhatever()), unless side effects if (false() && isWhatever()) -> if (false())
protected static void shortCircuitOr(JsExpression arg1, JsExpression arg2, JsContext ctx)
if (true() || isWhatever()) -> if (true()) if (false || isWhatever()) -> if (isWhatever()), unless side effects
protected static void trySimplifyComma(JsExpression arg1, JsExpression arg2, JsContext ctx)
public <T extends JsVisitable> T execImpl(T node)
public OptimizerStats execImpl()
Copyright © 2018. All rights reserved.