mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: eliminate OXFALL
Previously, we used OXFALL vs OFALL to distinguish fallthrough statements that had been validated. Because in the Node AST we flatten statement blocks, OXCASE and OXFALL needed to keep track of their block scopes for this purpose. Now that we have an AST that keeps these separate, we can just perform the validation earlier. Passes toolstash-check. Fixes #14540. Change-Id: I8421eaba16c2b3b72c9c5483b5cf20b14261385e Reviewed-on: https://go-review.googlesource.com/61130 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
c100a0f668
commit
4347baac7d
12 changed files with 72 additions and 54 deletions
|
|
@ -45,7 +45,6 @@ type Node struct {
|
|||
// - ONAME nodes that refer to local variables use it to identify their stack frame position.
|
||||
// - ODOT, ODOTPTR, and OINDREGSP use it to indicate offset relative to their base address.
|
||||
// - OSTRUCTKEY uses it to store the named field's offset.
|
||||
// - OXCASE and OXFALL use it to validate the use of fallthrough.
|
||||
// - Named OLITERALs use it to to store their ambient iota value.
|
||||
// Possibly still more uses. If you find any, document them.
|
||||
Xoffset int64
|
||||
|
|
@ -564,8 +563,8 @@ const (
|
|||
OCONTINUE // continue
|
||||
ODEFER // defer Left (Left must be call)
|
||||
OEMPTY // no-op (empty statement)
|
||||
OFALL // fallthrough (after processing)
|
||||
OXFALL // fallthrough (before processing)
|
||||
_ // placeholder to appease toolstash
|
||||
OFALL // fallthrough
|
||||
OFOR // for Ninit; Left; Right { Nbody }
|
||||
OFORUNTIL // for Ninit; Left; Right { Nbody } ; test applied after executing body, not before
|
||||
OGOTO // goto Left
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue