[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
@@ -198,7 +198,8 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
return ExitCode.COMPILATION_ERROR
}
// TODO: Handle main call parameters
// TODO: Handle non-empty main call arguments
val mainCallArguments = if (K2JsArgumentConstants.NO_CALL == arguments.main) null else emptyList<String>()
val dependencies = libraries.flatMap { listOfNotNull(loadIrLibrary(it, messageCollector)) }
.distinctBy { it.moduleName }
@@ -214,7 +215,8 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
sourcesFiles,
configuration,
immediateDependencies = dependencies,
allDependencies = dependencies
allDependencies = dependencies,
mainArguments = mainCallArguments
)
outputFile.writeText(compiledModule)