JS IR: remove obsolete hack from SymbolTable
This commit is contained in:
@@ -504,62 +504,6 @@ open class SymbolTable : ReferenceSymbolTable {
|
||||
else ->
|
||||
throw IllegalArgumentException("Unexpected value descriptor: $value")
|
||||
}
|
||||
|
||||
fun loadModule(module: IrModuleFragment) {
|
||||
module.acceptVoid(object: IrElementVisitorVoid {
|
||||
override fun visitElement(element: IrElement) {
|
||||
element.acceptChildrenVoid(this)
|
||||
}
|
||||
|
||||
override fun visitClass(declaration: IrClass) {
|
||||
// TODO should we check there are no conflicts?
|
||||
classSymbolTable.descriptorToSymbol[declaration.descriptor] = declaration.symbol
|
||||
super.visitClass(declaration)
|
||||
}
|
||||
|
||||
override fun visitConstructor(declaration: IrConstructor) {
|
||||
constructorSymbolTable.descriptorToSymbol[declaration.descriptor] = declaration.symbol
|
||||
super.visitConstructor(declaration)
|
||||
}
|
||||
|
||||
override fun visitEnumEntry(declaration: IrEnumEntry) {
|
||||
enumEntrySymbolTable.descriptorToSymbol[declaration.descriptor] = declaration.symbol
|
||||
super.visitEnumEntry(declaration)
|
||||
}
|
||||
|
||||
override fun visitExternalPackageFragment(declaration: IrExternalPackageFragment) {
|
||||
externalPackageFragmentTable.descriptorToSymbol[declaration.symbol.descriptor] = declaration.symbol
|
||||
super.visitExternalPackageFragment(declaration)
|
||||
}
|
||||
|
||||
override fun visitField(declaration: IrField) {
|
||||
fieldSymbolTable.descriptorToSymbol[declaration.descriptor] = declaration.symbol
|
||||
super.visitField(declaration)
|
||||
}
|
||||
|
||||
override fun visitSimpleFunction(declaration: IrSimpleFunction) {
|
||||
simpleFunctionSymbolTable.descriptorToSymbol[declaration.descriptor] = declaration.symbol
|
||||
super.visitSimpleFunction(declaration)
|
||||
}
|
||||
|
||||
override fun visitTypeParameter(declaration: IrTypeParameter) {
|
||||
// What about scoped type parameters?
|
||||
globalTypeParameterSymbolTable.descriptorToSymbol[declaration.descriptor] = declaration.symbol
|
||||
super.visitTypeParameter(declaration)
|
||||
}
|
||||
|
||||
override fun visitCall(expression: IrCall) {
|
||||
expression.symbol.let {
|
||||
when (it) {
|
||||
is IrSimpleFunctionSymbol -> simpleFunctionSymbolTable.descriptorToSymbol[it.descriptor] = it
|
||||
is IrConstructorSymbol -> constructorSymbolTable.descriptorToSymbol[it.descriptor] = it
|
||||
}
|
||||
}
|
||||
|
||||
super.visitCall(expression)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <T, D: DeclarationDescriptor> SymbolTable.withScope(owner: D, block: SymbolTable.(D) -> T): T {
|
||||
|
||||
Reference in New Issue
Block a user