cmd/compile/internal/gc: introduce type for decl contexts/storage classes
Change-Id: I956e27fa07f16060b8f41b986d991c36557f7c12
Reviewed-on: https://go-review.googlesource.com/16332
Reviewed-by: Keith Randall <khr@golang.org>
diff --git a/src/cmd/compile/internal/gc/go.go b/src/cmd/compile/internal/gc/go.go
index 9b91b57..550f332 100644
--- a/src/cmd/compile/internal/gc/go.go
+++ b/src/cmd/compile/internal/gc/go.go
@@ -333,19 +333,23 @@
Cboth = Crecv | Csend
)
-// declaration context
+// The Class of a variable/function describes the "storage class"
+// of a variable or function. During parsing, storage classes are
+// called declaration contexts.
+type Class uint8
+
const (
- Pxxx = uint8(iota)
- PEXTERN // global variable
- PAUTO // local variables
- PPARAM // input arguments
- PPARAMOUT // output results
- PPARAMREF // closure variable reference
- PFUNC // global function
+ Pxxx Class = iota
+ PEXTERN // global variable
+ PAUTO // local variables
+ PPARAM // input arguments
+ PPARAMOUT // output results
+ PPARAMREF // closure variable reference
+ PFUNC // global function
PDISCARD // discard during parse of duplicate import
- PHEAP = uint8(1 << 7) // an extra bit to identify an escaped variable
+ PHEAP = 1 << 7 // an extra bit to identify an escaped variable
)
const (
@@ -587,7 +591,7 @@
var funcsyms []*Node
-var dclcontext uint8 // PEXTERN/PAUTO
+var dclcontext Class // PEXTERN/PAUTO
var incannedimport int