JS_IR: fix property name generation
This commit is contained in:
+5
-6
@@ -43,12 +43,11 @@ class JsGenerationContext {
|
|||||||
this.currentFunction = func
|
this.currentFunction = func
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getNameForDeclaration(declaration: IrDeclaration): JsName = when (declaration) {
|
fun getNameForDeclaration(declaration: IrDeclaration): JsName =
|
||||||
is IrSymbolOwner -> getNameForSymbol(declaration.symbol)
|
if (declaration is IrSymbolOwner)
|
||||||
// Properties don't have symbols. Handling them separately:
|
getNameForSymbol(declaration.symbol)
|
||||||
is IrProperty -> currentScope.declareName(declaration.getJsName() ?: declaration.name.identifier)
|
else
|
||||||
else -> error("Unsupported")
|
error("Unsupported")
|
||||||
}
|
|
||||||
|
|
||||||
fun getNameForSymbol(symbol: IrSymbol): JsName = staticContext.getNameForSymbol(symbol, this)
|
fun getNameForSymbol(symbol: IrSymbol): JsName = staticContext.getNameForSymbol(symbol, this)
|
||||||
fun getNameForType(type: IrType): JsName = staticContext.getNameForType(type, this)
|
fun getNameForType(type: IrType): JsName = staticContext.getNameForType(type, this)
|
||||||
|
|||||||
+4
@@ -47,6 +47,10 @@ class SimpleNameGenerator : NameGenerator {
|
|||||||
|
|
||||||
val declarationName = declaration.getJsNameOrKotlinName().asString()
|
val declarationName = declaration.getJsNameOrKotlinName().asString()
|
||||||
|
|
||||||
|
if (declaration is IrProperty) {
|
||||||
|
return context.currentScope.declareName(declaration.getJsNameOrKotlinName().asString())
|
||||||
|
}
|
||||||
|
|
||||||
if (declaration is IrSimpleFunction && declaration.origin == JsLoweredDeclarationOrigin.BRIDGE_TO_EXTERNAL_FUNCTION) {
|
if (declaration is IrSimpleFunction && declaration.origin == JsLoweredDeclarationOrigin.BRIDGE_TO_EXTERNAL_FUNCTION) {
|
||||||
return nameDeclarator(declarationName)
|
return nameDeclarator(declarationName)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user