src/runtime: return a nil pointer for compiler bugs in hashmap code
We'll still panic if there's a compiler bug, but at least we'll have smaller code in all the cases where we don't.
Этот коммит содержится в:
родитель
1abe1203a3
коммит
b251ce7b33
1 изменённых файлов: 4 добавлений и 2 удалений
|
@ -91,7 +91,8 @@ func hashmapKeyEqualAlg(alg hashmapAlgorithm) func(x, y unsafe.Pointer, n uintpt
|
||||||
case hashmapAlgorithmInterface:
|
case hashmapAlgorithmInterface:
|
||||||
return hashmapInterfaceEqual
|
return hashmapInterfaceEqual
|
||||||
default:
|
default:
|
||||||
panic("unknown hashmap equal algorithm")
|
// compiler bug :(
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +105,8 @@ func hashmapKeyHashAlg(alg hashmapAlgorithm) func(key unsafe.Pointer, n uintptr)
|
||||||
case hashmapAlgorithmInterface:
|
case hashmapAlgorithmInterface:
|
||||||
return hashmapInterfacePtrHash
|
return hashmapInterfacePtrHash
|
||||||
default:
|
default:
|
||||||
panic("unknown hashmap hash algorithm")
|
// compiler bug :(
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче