Files
llgo/internal/runtime/error.go

28 lines
454 B
Go
Raw Normal View History

2024-05-16 15:09:00 +08:00
package runtime
type errorString string
func (e errorString) RuntimeError() {}
func (e errorString) Error() string {
return "runtime error: " + string(e)
}
func AssertRuntimeError(b bool, msg string) {
2024-05-16 15:09:00 +08:00
if b {
panic(errorString(msg).Error())
}
}
func AssertNegativeShift(b bool) {
if b {
panic(errorString("negative shift amount").Error())
}
}
func AssertIndexRange(b bool) {
if b {
panic(errorString("index out of range").Error())
2024-05-16 15:09:00 +08:00
}
}