[JS IR] store signatures for private symbols separately from public
Those signatures are used in JS IR IC
This commit is contained in:
committed by
TeamCityServer
parent
cb3538db92
commit
4de69fb4b5
@@ -43,6 +43,8 @@ abstract class Fir2IrBindableSymbol<out D : DeclarationDescriptor, B : IrDeclara
|
|||||||
override val hasDescriptor: Boolean
|
override val hasDescriptor: Boolean
|
||||||
get() = false
|
get() = false
|
||||||
|
|
||||||
|
override var privateSignature: IdSignature? = null
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
if (isBound) return owner.render()
|
if (isBound) return owner.render()
|
||||||
return "Unbound public symbol for $signature"
|
return "Unbound public symbol for $signature"
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ class IrFactoryImplForJsIC(override val stageController: StageController) : Abst
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun declarationSignature(declaration: IrDeclaration): IdSignature? {
|
override fun declarationSignature(declaration: IrDeclaration): IdSignature? {
|
||||||
return declarationToSignature[declaration] ?: declaration.symbol.signature
|
return declarationToSignature[declaration] ?: declaration.symbol.signature ?: declaration.symbol.privateSignature
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createAnonymousInitializer(
|
override fun createAnonymousInitializer(
|
||||||
|
|||||||
@@ -33,6 +33,12 @@ abstract class IrDelegatingSymbol<S : IrBindableSymbol<D, B>, B : IrSymbolOwner,
|
|||||||
if (delegate === other) return true
|
if (delegate === other) return true
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override var privateSignature: IdSignature?
|
||||||
|
get() = delegate.privateSignature
|
||||||
|
set(value) {
|
||||||
|
delegate.privateSignature = value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class IrDelegatingClassSymbolImpl(delegate: IrClassSymbol) :
|
class IrDelegatingClassSymbolImpl(delegate: IrClassSymbol) :
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ interface IrSymbol {
|
|||||||
val isBound: Boolean
|
val isBound: Boolean
|
||||||
|
|
||||||
val signature: IdSignature?
|
val signature: IdSignature?
|
||||||
|
|
||||||
|
// Used to store signatures in private symbols for JS IC
|
||||||
|
var privateSignature: IdSignature?
|
||||||
}
|
}
|
||||||
|
|
||||||
val IrSymbol.isPublicApi: Boolean
|
val IrSymbol.isPublicApi: Boolean
|
||||||
|
|||||||
+2
@@ -30,4 +30,6 @@ class DescriptorlessExternalPackageFragmentSymbol : IrExternalPackageFragmentSym
|
|||||||
override fun bind(owner: IrExternalPackageFragment) {
|
override fun bind(owner: IrExternalPackageFragment) {
|
||||||
_owner = owner
|
_owner = owner
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override var privateSignature: IdSignature? = null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ abstract class IrBindableSymbolBase<out D : DeclarationDescriptor, B : IrSymbolO
|
|||||||
|
|
||||||
override val isBound: Boolean
|
override val isBound: Boolean
|
||||||
get() = _owner != null
|
get() = _owner != null
|
||||||
|
|
||||||
|
override var privateSignature: IdSignature? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
class IrFileSymbolImpl(descriptor: PackageFragmentDescriptor? = null) :
|
class IrFileSymbolImpl(descriptor: PackageFragmentDescriptor? = null) :
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ abstract class IrBindablePublicSymbolBase<out D : DeclarationDescriptor, B : IrS
|
|||||||
|
|
||||||
override val isBound: Boolean
|
override val isBound: Boolean
|
||||||
get() = _owner != null
|
get() = _owner != null
|
||||||
|
|
||||||
|
override var privateSignature: IdSignature? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
class IrClassPublicSymbolImpl(sig: IdSignature, descriptor: ClassDescriptor? = null) :
|
class IrClassPublicSymbolImpl(sig: IdSignature, descriptor: ClassDescriptor? = null) :
|
||||||
|
|||||||
@@ -488,7 +488,9 @@ open class SymbolTable(
|
|||||||
override fun referenceClassFromLinker(sig: IdSignature): IrClassSymbol =
|
override fun referenceClassFromLinker(sig: IdSignature): IrClassSymbol =
|
||||||
classSymbolTable.run {
|
classSymbolTable.run {
|
||||||
if (sig.isPubliclyVisible) referenced(sig, false) { IrClassPublicSymbolImpl(sig) }
|
if (sig.isPubliclyVisible) referenced(sig, false) { IrClassPublicSymbolImpl(sig) }
|
||||||
else IrClassSymbolImpl(signature = sig)
|
else IrClassSymbolImpl().also {
|
||||||
|
it.privateSignature = sig
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val unboundClasses: Set<IrClassSymbol> get() = classSymbolTable.unboundSymbols
|
val unboundClasses: Set<IrClassSymbol> get() = classSymbolTable.unboundSymbols
|
||||||
@@ -841,7 +843,9 @@ open class SymbolTable(
|
|||||||
override fun referenceSimpleFunctionFromLinker(sig: IdSignature): IrSimpleFunctionSymbol {
|
override fun referenceSimpleFunctionFromLinker(sig: IdSignature): IrSimpleFunctionSymbol {
|
||||||
return simpleFunctionSymbolTable.run {
|
return simpleFunctionSymbolTable.run {
|
||||||
if (sig.isPubliclyVisible) referenced(sig, false) { IrSimpleFunctionPublicSymbolImpl(sig) }
|
if (sig.isPubliclyVisible) referenced(sig, false) { IrSimpleFunctionPublicSymbolImpl(sig) }
|
||||||
else IrSimpleFunctionSymbolImpl(signature = sig)
|
else IrSimpleFunctionSymbolImpl().also {
|
||||||
|
it.privateSignature = sig
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user