diff options
| author | David Chase <drchase@google.com> | 2024-05-22 16:00:29 -0400 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-05-23 01:04:30 +0000 |
| commit | 997b6969fd7be64a03255ef998981de716aa4313 (patch) | |
| tree | e9582ede2dd982ee60d9bf02ad84d7f663e74f71 /src/runtime/panic.go | |
| parent | b0b1d42db32a992150dd26681d3bda222e108303 (diff) | |
| download | go-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.go | 17 |
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") |
