aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/expr.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2020-12-23 06:06:31 -0800
committerMatthew Dempsky <mdempsky@google.com>2020-12-23 14:38:23 +0000
commitd1d64e4cea41bf908152e6a9c45980946e7825a2 (patch)
treef07ab854197179be69b5779b1386e31cf75597f4 /src/cmd/compile/internal/typecheck/expr.go
parentd19018e8f1970e2232b35931546ef60cdc0734d1 (diff)
downloadgo-d1d64e4cea41bf908152e6a9c45980946e7825a2.tar.gz
go-d1d64e4cea41bf908152e6a9c45980946e7825a2.zip
[dev.regabi] cmd/compile: split SliceExpr.List into separate fields
Passes toolstash -cmp. Change-Id: I4e31154d04d99f2b80bec6a2c571a2a4a3f2ec99 Reviewed-on: https://go-review.googlesource.com/c/go/+/279959 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/expr.go')
-rw-r--r--src/cmd/compile/internal/typecheck/expr.go22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/cmd/compile/internal/typecheck/expr.go b/src/cmd/compile/internal/typecheck/expr.go
index 00615c506c..6bbb68550e 100644
--- a/src/cmd/compile/internal/typecheck/expr.go
+++ b/src/cmd/compile/internal/typecheck/expr.go
@@ -831,17 +831,11 @@ func tcSPtr(n *ir.UnaryExpr) ir.Node {
// tcSlice typechecks an OSLICE or OSLICE3 node.
func tcSlice(n *ir.SliceExpr) ir.Node {
- n.X = Expr(n.X)
- low, high, max := n.SliceBounds()
+ n.X = DefaultLit(Expr(n.X), nil)
+ n.Low = indexlit(Expr(n.Low))
+ n.High = indexlit(Expr(n.High))
+ n.Max = indexlit(Expr(n.Max))
hasmax := n.Op().IsSlice3()
- low = Expr(low)
- high = Expr(high)
- max = Expr(max)
- n.X = DefaultLit(n.X, nil)
- low = indexlit(low)
- high = indexlit(high)
- max = indexlit(max)
- n.SetSliceBounds(low, high, max)
l := n.X
if l.Type() == nil {
n.SetType(nil)
@@ -886,19 +880,19 @@ func tcSlice(n *ir.SliceExpr) ir.Node {
return n
}
- if low != nil && !checksliceindex(l, low, tp) {
+ if n.Low != nil && !checksliceindex(l, n.Low, tp) {
n.SetType(nil)
return n
}
- if high != nil && !checksliceindex(l, high, tp) {
+ if n.High != nil && !checksliceindex(l, n.High, tp) {
n.SetType(nil)
return n
}
- if max != nil && !checksliceindex(l, max, tp) {
+ if n.Max != nil && !checksliceindex(l, n.Max, tp) {
n.SetType(nil)
return n
}
- if !checksliceconst(low, high) || !checksliceconst(low, max) || !checksliceconst(high, max) {
+ if !checksliceconst(n.Low, n.High) || !checksliceconst(n.Low, n.Max) || !checksliceconst(n.High, n.Max) {
n.SetType(nil)
return n
}