[JS BE] add flag es6mode
This commit is contained in:
+3
@@ -9,4 +9,7 @@ import org.jetbrains.kotlin.backend.common.CommonBackendContext
|
||||
|
||||
interface JsCommonBackendContext : CommonBackendContext {
|
||||
override val mapping: JsMapping
|
||||
|
||||
val es6mode: Boolean
|
||||
get() = false
|
||||
}
|
||||
@@ -41,7 +41,8 @@ class JsIrBackendContext(
|
||||
irModuleFragment: IrModuleFragment,
|
||||
val additionalExportedDeclarations: Set<FqName>,
|
||||
override val configuration: CompilerConfiguration, // TODO: remove configuration from backend context
|
||||
override val scriptMode: Boolean = false
|
||||
override val scriptMode: Boolean = false,
|
||||
override val es6mode: Boolean = false
|
||||
) : JsCommonBackendContext {
|
||||
override val transformedFunction
|
||||
get() = error("Use Mapping.inlineClassMemberToStatic instead")
|
||||
@@ -280,6 +281,7 @@ class JsIrBackendContext(
|
||||
|
||||
val newThrowableSymbol = symbolTable.referenceSimpleFunction(getJsInternalFunction("newThrowable"))
|
||||
val extendThrowableSymbol = symbolTable.referenceSimpleFunction(getJsInternalFunction("extendThrowable"))
|
||||
val setPropertiesToThrowableInstanceSymbol = symbolTable.referenceSimpleFunction(getJsInternalFunction("setPropertiesToThrowableInstance"))
|
||||
|
||||
val throwISEsymbol = symbolTable.referenceSimpleFunction(getFunctions(kotlinPackageFqn.child(Name.identifier("THROW_ISE"))).single())
|
||||
val throwIAEsymbol = symbolTable.referenceSimpleFunction(getFunctions(kotlinPackageFqn.child(Name.identifier("THROW_IAE"))).single())
|
||||
|
||||
@@ -45,7 +45,8 @@ fun compile(
|
||||
exportedDeclarations: Set<FqName> = emptySet(),
|
||||
generateFullJs: Boolean = true,
|
||||
generateDceJs: Boolean = false,
|
||||
dceDriven: Boolean = false
|
||||
dceDriven: Boolean = false,
|
||||
es6mode: Boolean = false
|
||||
): CompilerResult {
|
||||
stageController = object : StageController {}
|
||||
|
||||
@@ -56,7 +57,7 @@ fun compile(
|
||||
|
||||
val mainFunction = JsMainFunctionDetector.getMainFunctionOrNull(moduleFragment)
|
||||
|
||||
val context = JsIrBackendContext(moduleDescriptor, irBuiltIns, symbolTable, moduleFragment, exportedDeclarations, configuration)
|
||||
val context = JsIrBackendContext(moduleDescriptor, irBuiltIns, symbolTable, moduleFragment, exportedDeclarations, configuration, es6mode = es6mode)
|
||||
|
||||
// Load declarations referenced during `context` initialization
|
||||
val irProviders = listOf(deserializer)
|
||||
|
||||
Reference in New Issue
Block a user