[JS IR BE] Turn on strict mode in generated code.

Fix multiple import of the same javascript module.
This commit is contained in:
Svyatoslav Kuzmich
2019-05-09 15:23:53 +03:00
parent 0f90aa5f80
commit bd3953c09f
@@ -28,7 +28,9 @@ class IrModuleToJsTransformer(
private val moduleKind = backendContext.configuration[JSConfigurationKeys.MODULE_KIND]!!
private fun generateModuleBody(module: IrModuleFragment, context: JsGenerationContext): List<JsStatement> {
val statements = mutableListOf<JsStatement>()
val statements = mutableListOf<JsStatement>(
JsStringLiteral("use strict").makeStmt()
)
// TODO: fix it up with new name generator
val anyName = context.getNameForClass(backendContext.irBuiltIns.anyClass.owner)
@@ -251,7 +253,7 @@ class IrModuleToJsTransformer(
}
}
val importedJsModules = declarationLevelJsModules + packageLevelJsModules
val importedJsModules = (declarationLevelJsModules + packageLevelJsModules).distinctBy { it.key }
return Pair(importStatements, importedJsModules)
}