[JS IR BE] Support main function

* Implement IR-based main function detector
This commit is contained in:
Roman Artemev
2019-04-18 11:07:04 +03:00
committed by romanart
parent 6729603ac7
commit 5bd3bcd237
11 changed files with 131 additions and 11 deletions
@@ -96,7 +96,8 @@ abstract class BasicIrBoxTest(
configuration = config.configuration,
phaseConfig = config.configuration.get(CLIConfigurationKeys.PHASE_CONFIG) ?: PhaseConfig(jsPhases),
immediateDependencies = dependencies,
allDependencies = allDependencies
allDependencies = allDependencies,
mainArguments = mainCallParameters.run { if (shouldBeGenerated()) arguments() else null }
)
val wrappedCode = wrapWithModuleEmulationMarkers(jsCode, moduleId = config.moduleId, moduleKind = config.moduleKind)
+10 -1
View File
@@ -1,5 +1,4 @@
// EXPECTED_REACHABLE_NODES: 1281
// IGNORE_BACKEND: JS_IR
// CALL_MAIN
// FILE: ok.kt
@@ -19,6 +18,16 @@ fun main(args: Array<String>) {
ok = "fail: b.b"
}
// FILE: 0.kt
package b
import ok.*
fun main(args: Array<String>) {
ok = "fail: b"
}
// FILE: 2.kt
package a
-1
View File
@@ -1,5 +1,4 @@
// EXPECTED_REACHABLE_NODES: 1281
// IGNORE_BACKEND: JS_IR
// CALL_MAIN
var ok: String = "fail"
-1
View File
@@ -1,5 +1,4 @@
// EXPECTED_REACHABLE_NODES: 1281
// IGNORE_BACKEND: JS_IR
// CALL_MAIN
var ok: String = "fail"
-1
View File
@@ -1,5 +1,4 @@
// EXPECTED_REACHABLE_NODES: 1296
// IGNORE_BACKEND: JS_IR
// CALL_MAIN
import kotlin.coroutines.*
@@ -1,5 +1,4 @@
// EXPECTED_REACHABLE_NODES: 1296
// IGNORE_BACKEND: JS_IR
// CALL_MAIN
import kotlin.coroutines.*