compiler: improve panic message when a runtime call is unavailable
This should not happen under normal circumstances. It can still happen when there is a mismatch between TinyGo version and the associated runtime, or while developing the compiler package.
Этот коммит содержится в:
родитель
f1e25a18d2
коммит
62294feb56
1 изменённых файлов: 5 добавлений и 1 удалений
|
@ -36,7 +36,11 @@ const (
|
||||||
// createRuntimeCallCommon creates a runtime call. Use createRuntimeCall or
|
// createRuntimeCallCommon creates a runtime call. Use createRuntimeCall or
|
||||||
// createRuntimeInvoke instead.
|
// createRuntimeInvoke instead.
|
||||||
func (b *builder) createRuntimeCallCommon(fnName string, args []llvm.Value, name string, isInvoke bool) llvm.Value {
|
func (b *builder) createRuntimeCallCommon(fnName string, args []llvm.Value, name string, isInvoke bool) llvm.Value {
|
||||||
fn := b.program.ImportedPackage("runtime").Members[fnName].(*ssa.Function)
|
member := b.program.ImportedPackage("runtime").Members[fnName]
|
||||||
|
if member == nil {
|
||||||
|
panic("unknown runtime call: " + fnName)
|
||||||
|
}
|
||||||
|
fn := member.(*ssa.Function)
|
||||||
fnType, llvmFn := b.getFunction(fn)
|
fnType, llvmFn := b.getFunction(fn)
|
||||||
if llvmFn.IsNil() {
|
if llvmFn.IsNil() {
|
||||||
panic("trying to call non-existent function: " + fn.RelString(nil))
|
panic("trying to call non-existent function: " + fn.RelString(nil))
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче