[JS SCRIPT] Fix IrBuiltIns to make it stable if symbols already defined

This commit is contained in:
Roman Artemev
2020-05-14 13:33:11 +03:00
committed by romanart
parent 8f71bdbf01
commit 52a93f189e
@@ -60,7 +60,7 @@ class IrBuiltIns(
operatorDescriptor.addValueParameter(valueParameterDescriptor) operatorDescriptor.addValueParameter(valueParameterDescriptor)
} }
val symbol = symbolTable.declareSimpleFunction(UNDEFINED_OFFSET, UNDEFINED_OFFSET, BUILTIN_OPERATOR, operatorDescriptor) { val symbol = symbolTable.declareSimpleFunctionIfNotExists(operatorDescriptor) {
val operator = IrBuiltInOperator(it, Name.identifier(name), returnType) val operator = IrBuiltInOperator(it, Name.identifier(name), returnType)
operator.parent = packageFragment operator.parent = packageFragment
packageFragment.declarations += operator packageFragment.declarations += operator
@@ -134,7 +134,7 @@ class IrBuiltIns(
buildSimpleType() buildSimpleType()
} }
return symbolTable.declareSimpleFunction(UNDEFINED_OFFSET, UNDEFINED_OFFSET, BUILTIN_OPERATOR, operatorDescriptor) { return symbolTable.declareSimpleFunctionIfNotExists(operatorDescriptor) {
val operator = IrBuiltInOperator(it, name, returnIrType) val operator = IrBuiltInOperator(it, name, returnIrType)
operator.parent = packageFragment operator.parent = packageFragment
packageFragment.declarations += operator packageFragment.declarations += operator