aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/panic.go
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2024-05-22 16:00:29 -0400
committerGopher Robot <gobot@golang.org>2024-05-23 01:04:30 +0000
commit997b6969fd7be64a03255ef998981de716aa4313 (patch)
treee9582ede2dd982ee60d9bf02ad84d7f663e74f71 /src/runtime/panic.go
parentb0b1d42db32a992150dd26681d3bda222e108303 (diff)
downloadgo-997b6969fd7be64a03255ef998981de716aa4313.tar.xz
internal/abi, cmd/compile, runtime: deduplicate rangefunc consts
Change-Id: I61ec5a7fa0c10f95ae2261c3349743d6fda2c1d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/587596 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/panic.go')
-rw-r--r--src/runtime/panic.go17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/runtime/panic.go b/src/runtime/panic.go
index 9a710f6edf..e182b0b733 100644
--- a/src/runtime/panic.go
+++ b/src/runtime/panic.go
@@ -304,21 +304,14 @@ var rangeMissingPanicError = error(errorString("range function recovered a loop
//go:noinline
func panicrangestate(state int) {
- const (
- // These duplicate magic numbers in cmd/compile/internal/rangefunc
- DONE = 0 // body of loop has exited in a non-panic way
- PANIC = 2 // body of loop is either currently running, or has panicked
- EXHAUSTED = 3 // iterator function return, i.e., sequence is "exhausted"
- MISSING_PANIC = 4 // body of loop panicked but iterator function defer-recovered it away
- )
- switch state {
- case DONE:
+ switch abi.RF_State(state) {
+ case abi.RF_DONE:
panic(rangeDoneError)
- case PANIC:
+ case abi.RF_PANIC:
panic(rangePanicError)
- case EXHAUSTED:
+ case abi.RF_EXHAUSTED:
panic(rangeExhaustedError)
- case MISSING_PANIC:
+ case abi.RF_MISSING_PANIC:
panic(rangeMissingPanicError)
}
throw("unexpected state passed to panicrangestate")