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 JsExpression |
shortCircuitAnd(JsBinaryOperation expr)
Simplify short circuit AND expressions.
|
protected static JsExpression |
shortCircuitOr(JsBinaryOperation expr)
Simplify short circuit OR expressions.
|
protected static JsExpression |
trySimplifyComma(JsBinaryOperation expr) |
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 JsExpression shortCircuitAnd(JsBinaryOperation expr)
if (true && isWhatever()) -> if (isWhatever()), unless side effects if (false() && isWhatever()) -> if (false())
protected static JsExpression shortCircuitOr(JsBinaryOperation expr)
if (true() || isWhatever()) -> if (true()) if (false || isWhatever()) -> if (isWhatever()), unless side effects
protected static JsExpression trySimplifyComma(JsBinaryOperation expr)
public <T extends JsVisitable> T execImpl(T node)
public OptimizerStats execImpl()
Copyright © 2018. All rights reserved.