JS/Inlining: minor code style fixes
This commit is contained in:
@@ -147,7 +147,7 @@ internal class ExpressionDecomposer private constructor(
|
|||||||
|
|
||||||
val tmp = Temporary(arg1)
|
val tmp = Temporary(arg1)
|
||||||
addStatement(tmp.variable)
|
addStatement(tmp.variable)
|
||||||
var test = if (operator == JsBinaryOperator.OR) not(tmp.nameRef) else tmp.nameRef
|
val test = if (operator == JsBinaryOperator.OR) not(tmp.nameRef) else tmp.nameRef
|
||||||
val arg2Eval = withNewAdditionalStatements {
|
val arg2Eval = withNewAdditionalStatements {
|
||||||
arg2 = accept(arg2)
|
arg2 = accept(arg2)
|
||||||
addStatement(tmp.assign(arg2))
|
addStatement(tmp.assign(arg2))
|
||||||
@@ -260,7 +260,7 @@ internal class ExpressionDecomposer private constructor(
|
|||||||
|
|
||||||
private fun Callable.process() {
|
private fun Callable.process() {
|
||||||
qualifier = accept(qualifier)
|
qualifier = accept(qualifier)
|
||||||
var matchedIndices = arguments.indicesOfExtractable
|
val matchedIndices = arguments.indicesOfExtractable
|
||||||
if (!matchedIndices.hasNext()) return
|
if (!matchedIndices.hasNext()) return
|
||||||
|
|
||||||
if (qualifier in containsNodeWithSideEffect) {
|
if (qualifier in containsNodeWithSideEffect) {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import static org.jetbrains.kotlin.js.translate.utils.JsAstUtils.flattenStatemen
|
|||||||
|
|
||||||
public class JsInliner extends JsVisitorWithContextImpl {
|
public class JsInliner extends JsVisitorWithContextImpl {
|
||||||
|
|
||||||
private final IdentityHashMap<JsName, JsFunction> functions;
|
private final Map<JsName, JsFunction> functions;
|
||||||
private final Stack<JsInliningContext> inliningContexts = new Stack<JsInliningContext>();
|
private final Stack<JsInliningContext> inliningContexts = new Stack<JsInliningContext>();
|
||||||
private final Set<JsFunction> processedFunctions = CollectionUtilsKt.IdentitySet();
|
private final Set<JsFunction> processedFunctions = CollectionUtilsKt.IdentitySet();
|
||||||
private final Set<JsFunction> inProcessFunctions = CollectionUtilsKt.IdentitySet();
|
private final Set<JsFunction> inProcessFunctions = CollectionUtilsKt.IdentitySet();
|
||||||
@@ -73,7 +73,7 @@ public class JsInliner extends JsVisitorWithContextImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private JsInliner(
|
private JsInliner(
|
||||||
@NotNull IdentityHashMap<JsName, JsFunction> functions,
|
@NotNull Map<JsName, JsFunction> functions,
|
||||||
@NotNull FunctionReader functionReader,
|
@NotNull FunctionReader functionReader,
|
||||||
@NotNull DiagnosticSink trace
|
@NotNull DiagnosticSink trace
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ internal class ReferenceTracker<in Reference, RemoveCandidate : JsNode> {
|
|||||||
get() {
|
get() {
|
||||||
return reachable
|
return reachable
|
||||||
.filter { !it.value }
|
.filter { !it.value }
|
||||||
.map { removableCandidates.get(it.key)!! }
|
.map { removableCandidates[it.key]!! }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addCandidateForRemoval(reference: Reference, candidate: RemoveCandidate) {
|
fun addCandidateForRemoval(reference: Reference, candidate: RemoveCandidate) {
|
||||||
|
|||||||
+1
-1
@@ -214,7 +214,7 @@ internal class TemporaryAssignmentElimination(private val root: JsBlock) {
|
|||||||
hasChanges = true
|
hasChanges = true
|
||||||
ctx.replaceMe(replacement)
|
ctx.replaceMe(replacement)
|
||||||
statementsToRemove += usageHolder.collectStatements()
|
statementsToRemove += usageHolder.collectStatements()
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.visit(x, ctx)
|
return super.visit(x, ctx)
|
||||||
|
|||||||
Reference in New Issue
Block a user