[JS IR BE] Add better error message when some function not found during init JsIrBackendContext

This commit is contained in:
Zalim Bashorov
2020-01-13 21:51:23 +03:00
parent 43171f67a8
commit 62014e6711
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -342,7 +342,7 @@ class JsIrBackendContext(
private fun getIrClass(fqName: FqName): IrClassSymbol = symbolTable.referenceClass(getClass(fqName))
internal fun getJsInternalFunction(name: String): SimpleFunctionDescriptor =
findFunctions(internalPackage.memberScope, Name.identifier(name)).single()
findFunctions(internalPackage.memberScope, Name.identifier(name)).singleOrNull() ?: error("Internal function '$name' not found")
fun getFunctions(fqName: FqName): List<SimpleFunctionDescriptor> =
findFunctions(module.getPackage(fqName.parent()).memberScope, fqName.shortName())