Commit 53d43cb5 authored by Robert Griesemer's avatar Robert Griesemer

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: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent cd7d7382
......@@ -963,7 +963,7 @@ var tagString = [...]string{
// untype returns the "pseudo" untyped type for a Ctype (import/export use only).
// (we can't use an pre-initialized array because we must be sure all types are
// set up)
func untype(ctype int) *Type {
func untype(ctype Ctype) *Type {
switch ctype {
case CTINT:
return idealint
......
This diff is collapsed.
......@@ -10,8 +10,6 @@ import (
"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 Val struct {
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 @@ const (
NTYPE
)
// Ctype describes the constant kind of an "ideal" (untyped) constant.
type Ctype int8
const (
CTxxx = iota
CTxxx Ctype = iota
CTINT
CTRUNE
......
......@@ -744,11 +744,11 @@ func exprcmp(c1, c2 *caseClause) int {
n2 := c2.node.Left
// sort by type (for switches on interface)
ct := int(n1.Val().Ctype())
if ct > int(n2.Val().Ctype()) {
ct := n1.Val().Ctype()
if ct > n2.Val().Ctype() {
return +1
}
if ct < int(n2.Val().Ctype()) {
if ct < n2.Val().Ctype() {
return -1
}
if !Eqtype(n1.Type, n2.Type) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment