JS/Inlining: introduce removal of expression statements without side effects

This commit is contained in:
Alexey Andreev
2016-05-05 12:27:33 +03:00
parent 551ed28d84
commit 65876c36eb
14 changed files with 508 additions and 11 deletions
@@ -72,7 +72,7 @@ abstract class BasicOptimizerTest(private var basePath: String) {
for (statement in unoptimizedAst) {
object : RecursiveJsVisitor() {
override fun visitFunction(x: JsFunction) {
FunctionPostProcessor(x.body).apply()
FunctionPostProcessor(x).apply()
super.visitFunction(x)
}
}.accept(statement)
@@ -0,0 +1,29 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.js.test.optimizer
import org.junit.Test
class IneffectiveStatementEliminationTest() : BasicOptimizerTest("ineffective-statement-elimination") {
@Test fun binary() = box()
@Test fun unary() = box()
@Test fun conditional() = box()
@Test fun literal() = box()
}