JS inline minor: inlined doDirectInline()
This commit is contained in:
committed by
Zalim Bashorov
parent
6018b103cc
commit
fb475775c9
@@ -84,7 +84,10 @@ class FunctionInlineMutator {
|
|||||||
renameLocalNames(namingContext, invokedFunction);
|
renameLocalNames(namingContext, invokedFunction);
|
||||||
|
|
||||||
if (canBeExpression(body)) {
|
if (canBeExpression(body)) {
|
||||||
doDirectInline();
|
resultExpr = asExpression(body);
|
||||||
|
body.getStatements().clear();
|
||||||
|
/** JsExpression can be immutable, so need to reassign */
|
||||||
|
resultExpr = (JsExpression) namingContext.applyRenameTo(resultExpr);
|
||||||
} else {
|
} else {
|
||||||
processReturns();
|
processReturns();
|
||||||
namingContext.applyRenameTo(body);
|
namingContext.applyRenameTo(body);
|
||||||
@@ -116,11 +119,6 @@ class FunctionInlineMutator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doDirectInline() {
|
|
||||||
resultExpr = asExpression(body);
|
|
||||||
body.getStatements().clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doReplaceReturns(int returnCount) {
|
private void doReplaceReturns(int returnCount) {
|
||||||
JsReturn returnOnTop = ContainerUtil.findInstance(body.getStatements(), JsReturn.class);
|
JsReturn returnOnTop = ContainerUtil.findInstance(body.getStatements(), JsReturn.class);
|
||||||
boolean hasReturnOnTopLevel = returnOnTop != null;
|
boolean hasReturnOnTopLevel = returnOnTop != null;
|
||||||
|
|||||||
Reference in New Issue
Block a user