diff options
author | Robert Griesemer <gri@golang.org> | 2015-09-01 22:25:23 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2015-09-01 22:25:23 +0000 |
commit | 16cb6de1a6a2a8d518ccc484cc86eb6ced76ad27 (patch) | |
tree | 374bff28443d471ac568e2a9c036ee67ad3c10f0 | |
parent | 98b7ff4bbcbd93974360f750198a7ae90666d16d (diff) | |
parent | 88421f4cb273a62118790d1a4166031adc82ba5d (diff) | |
download | tools-16cb6de1a6a2a8d518ccc484cc86eb6ced76ad27.tar.gz |
go/types: unexport UniverseByte/Rune; make Typ a slice
automerge: 88421f4
* commit '88421f4cb273a62118790d1a4166031adc82ba5d':
go/types: unexport UniverseByte/Rune; make Typ a slice
-rw-r--r-- | go/gccgoimporter/parser.go | 4 | ||||
-rw-r--r-- | go/importer/predefined.go | 5 | ||||
-rw-r--r-- | go/types/builtins.go | 4 | ||||
-rw-r--r-- | go/types/expr.go | 2 | ||||
-rw-r--r-- | go/types/predicates.go | 2 | ||||
-rw-r--r-- | go/types/stmt.go | 2 | ||||
-rw-r--r-- | go/types/universe.go | 12 |
7 files changed, 16 insertions, 15 deletions
diff --git a/go/gccgoimporter/parser.go b/go/gccgoimporter/parser.go index 5bd1858..d20a967 100644 --- a/go/gccgoimporter/parser.go +++ b/go/gccgoimporter/parser.go @@ -659,8 +659,8 @@ func lookupBuiltinType(typ int) types.Type { gccgoBuiltinCOMPLEX64: types.Typ[types.Complex64], gccgoBuiltinCOMPLEX128: types.Typ[types.Complex128], gccgoBuiltinERROR: types.Universe.Lookup("error").Type(), - gccgoBuiltinBYTE: types.Typ[types.Byte], - gccgoBuiltinRUNE: types.Typ[types.Rune], + gccgoBuiltinBYTE: types.Universe.Lookup("byte").Type(), + gccgoBuiltinRUNE: types.Universe.Lookup("rune").Type(), }[typ] } diff --git a/go/importer/predefined.go b/go/importer/predefined.go index a4db568..b23dfcb 100644 --- a/go/importer/predefined.go +++ b/go/importer/predefined.go @@ -76,8 +76,9 @@ var predeclared = []types.Type{ types.Typ[types.UnsafePointer], // aliases - types.UniverseByte, - types.UniverseRune, + types.Universe.Lookup("byte").Type(), + types.Universe.Lookup("rune").Type(), + // error types.Universe.Lookup("error").Type(), } diff --git a/go/types/builtins.go b/go/types/builtins.go index 3da49b9..f45f930 100644 --- a/go/types/builtins.go +++ b/go/types/builtins.go @@ -96,7 +96,7 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b // spec: "As a special case, append also accepts a first argument assignable // to type []byte with a second argument of string type followed by ... . // This form appends the bytes of the string. - if nargs == 2 && call.Ellipsis.IsValid() && x.assignableTo(check.conf, NewSlice(UniverseByte)) { + if nargs == 2 && call.Ellipsis.IsValid() && x.assignableTo(check.conf, NewSlice(universeByte)) { arg(x, 1) if x.mode == invalid { return @@ -289,7 +289,7 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b switch t := y.typ.Underlying().(type) { case *Basic: if isString(y.typ) { - src = UniverseByte + src = universeByte } case *Slice: src = t.elem diff --git a/go/types/expr.go b/go/types/expr.go index 78b14e0..6efc7b4 100644 --- a/go/types/expr.go +++ b/go/types/expr.go @@ -1183,7 +1183,7 @@ func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind { // (not a constant) even if the string and the // index are constant x.mode = value - x.typ = UniverseByte // use 'byte' name + x.typ = universeByte // use 'byte' name } case *Array: diff --git a/go/types/predicates.go b/go/types/predicates.go index b5c39d9..993c6d2 100644 --- a/go/types/predicates.go +++ b/go/types/predicates.go @@ -296,7 +296,7 @@ func defaultType(typ Type) Type { case UntypedInt: return Typ[Int] case UntypedRune: - return UniverseRune // use 'rune' name + return universeRune // use 'rune' name case UntypedFloat: return Typ[Float64] case UntypedComplex: diff --git a/go/types/stmt.go b/go/types/stmt.go index 0aafb30..eeb2c31 100644 --- a/go/types/stmt.go +++ b/go/types/stmt.go @@ -629,7 +629,7 @@ func (check *Checker) stmt(ctxt stmtContext, s ast.Stmt) { case *Basic: if isString(typ) { key = Typ[Int] - val = UniverseRune // use 'rune' name + val = universeRune // use 'rune' name } case *Array: key = Typ[Int] diff --git a/go/types/universe.go b/go/types/universe.go index 472c6be..12a34ef 100644 --- a/go/types/universe.go +++ b/go/types/universe.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// This file implements the universe and unsafe package scopes. +// This file sets up the universe scope and the unsafe package. package types @@ -17,11 +17,11 @@ var ( Universe *Scope Unsafe *Package universeIota *Const - UniverseByte *Basic // uint8 alias, but has name "byte" - UniverseRune *Basic // int32 alias, but has name "rune" + universeByte *Basic // uint8 alias, but has name "byte" + universeRune *Basic // int32 alias, but has name "rune" ) -var Typ = [...]*Basic{ +var Typ = []*Basic{ Invalid: {Invalid, 0, "invalid type"}, Bool: {Bool, IsBoolean, "bool"}, @@ -187,8 +187,8 @@ func init() { defPredeclaredFuncs() universeIota = Universe.Lookup("iota").(*Const) - UniverseByte = Universe.Lookup("byte").(*TypeName).typ.(*Basic) - UniverseRune = Universe.Lookup("rune").(*TypeName).typ.(*Basic) + universeByte = Universe.Lookup("byte").(*TypeName).typ.(*Basic) + universeRune = Universe.Lookup("rune").(*TypeName).typ.(*Basic) } // Objects with names containing blanks are internal and not entered into |