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