cmd/compile/internal/gc: introduce type for untyped constant kinds
Change-Id: Ia34b6dd099d07d5e1d4bffe775a20fa92705fdb0
Reviewed-on: https://go-review.googlesource.com/16335
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/src/cmd/compile/internal/gc/go.go b/src/cmd/compile/internal/gc/go.go
index 550f332..12f0749 100644
--- a/src/cmd/compile/internal/gc/go.go
+++ b/src/cmd/compile/internal/gc/go.go
@@ -10,8 +10,6 @@
"cmd/internal/obj"
)
-// avoid <ctype.h>
-
// The parser's maximum stack size.
// We have to use a #define macro here since yacc
// or bison will check for its definition and use
@@ -95,7 +93,7 @@
type NilVal struct{}
-func (v Val) Ctype() int {
+func (v Val) Ctype() Ctype {
switch x := v.U.(type) {
default:
Fatalf("unexpected Ctype for %T", v.U)
@@ -312,8 +310,11 @@
NTYPE
)
+// Ctype describes the constant kind of an "ideal" (untyped) constant.
+type Ctype int8
+
const (
- CTxxx = iota
+ CTxxx Ctype = iota
CTINT
CTRUNE