1
0
mirror of https://github.com/golang/go synced 2024-11-18 21:54:49 -07:00

go/types: Remove ancient Go 1.1 compatibility indirections.

Change-Id: Ie16cc01ea2bd4806eaa7bd77cfbd2fa90f11ea36
Reviewed-on: https://go-review.googlesource.com/17792
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
David Symonds 2015-12-14 11:44:26 +11:00
parent c0008c5889
commit e842f6af3a
3 changed files with 2 additions and 36 deletions

View File

@ -1246,7 +1246,7 @@ func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind {
switch typ := x.typ.Underlying().(type) {
case *Basic:
if isString(typ) {
if slice3(e) {
if e.Slice3 {
check.invalidOp(x.pos(), "3-index slice of string")
goto Error
}
@ -1290,7 +1290,7 @@ func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind {
x.mode = value
// spec: "Only the first index may be omitted; it defaults to 0."
if slice3(e) && (e.High == nil || sliceMax(e) == nil) {
if e.Slice3 && (e.High == nil || e.Max == nil) {
check.error(e.Rbrack, "2nd and 3rd index required in 3-index slice")
goto Error
}

View File

@ -1,17 +0,0 @@
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !go1.2
package types
import "go/ast"
func slice3(x *ast.SliceExpr) bool {
return false
}
func sliceMax(x *ast.SliceExpr) ast.Expr {
return nil
}

View File

@ -1,17 +0,0 @@
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.2
package types
import "go/ast"
func slice3(x *ast.SliceExpr) bool {
return x.Slice3
}
func sliceMax(x *ast.SliceExpr) ast.Expr {
return x.Max
}