[JS IR BE] Codegen class model refactorings
Reduce JsScope usage
This commit is contained in:
@@ -18,6 +18,5 @@ package org.jetbrains.kotlin.js.backend.ast
|
||||
|
||||
class JsClassModel(val name: JsName, val superName: JsName?) {
|
||||
val interfaces: MutableSet<JsName> = mutableSetOf()
|
||||
val preDeclarationBlock = JsGlobalBlock() // TODO only used in IR backend => hide from current backend
|
||||
val postDeclarationBlock = JsGlobalBlock()
|
||||
}
|
||||
|
||||
@@ -20,11 +20,15 @@ public class JsName extends HasMetadata implements Symbol {
|
||||
/**
|
||||
* @param ident the unmangled ident to use for this name
|
||||
*/
|
||||
JsName(@NotNull String ident, boolean temporary) {
|
||||
public JsName(@NotNull String ident, boolean temporary) {
|
||||
this.ident = ident;
|
||||
this.temporary = temporary;
|
||||
}
|
||||
|
||||
public JsName(@NotNull String ident) {
|
||||
this(ident, false);
|
||||
}
|
||||
|
||||
public boolean isTemporary() {
|
||||
return temporary;
|
||||
}
|
||||
|
||||
@@ -137,9 +137,7 @@ class ImportIntoFragmentInliningScope private constructor(
|
||||
get() = JsBlock(
|
||||
JsBlock(fragment.inlinedLocalDeclarations.values.toList()),
|
||||
fragment.declarationBlock,
|
||||
JsBlock(fragment.classes.values.flatMap {
|
||||
listOf(it.preDeclarationBlock, it.postDeclarationBlock)
|
||||
}),
|
||||
JsBlock(fragment.classes.values.map { it.postDeclarationBlock }),
|
||||
fragment.exportBlock,
|
||||
JsExpressionStatement(JsFunction(JsDynamicScope, fragment.initializerBlock, ""))
|
||||
).also { block ->
|
||||
|
||||
Reference in New Issue
Block a user