aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/noder/helpers.go
diff options
context:
space:
mode:
authorDan Scales <danscales@google.com>2021-01-19 13:54:33 -0800
committerDan Scales <danscales@google.com>2021-01-22 17:16:22 +0000
commit12cd9cf7e080806f86595d71078a30e654458ebe (patch)
treee07920049ee8de09c6796fdad9654b9e9b9e57ee /src/cmd/compile/internal/noder/helpers.go
parentf8654579cdd637167bb38d38f0de76abc812d34c (diff)
downloadgo-12cd9cf7e080806f86595d71078a30e654458ebe.tar.gz
go-12cd9cf7e080806f86595d71078a30e654458ebe.zip
[dev.typeparams] cmd/compile: disambiguate OXDOT in noder using types2 Selection info
By using the types2 Selection information, we can create ODOT, ODOTPTR, OCALLPART, ODOTMETH, ODOTINTER, and OMETHEXPR nodes directly in noder, so we don't have to do that functionality in typecheck.go. Intermediate nodes are created as needed for embedded fields. Don't have to typecheck the results of g.selectorExpr(), because we set the types of all the needed nodes. There is one bug remaining in 'go test reflect' that will be fixed when dev.regabi is merged. Change-Id: I4599d43197783e318610deb2f208137f9344ab63 Reviewed-on: https://go-review.googlesource.com/c/go/+/285373 Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Dan Scales <danscales@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/noder/helpers.go')
-rw-r--r--src/cmd/compile/internal/noder/helpers.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/noder/helpers.go b/src/cmd/compile/internal/noder/helpers.go
index 3c20f74d8b..e43ea630bd 100644
--- a/src/cmd/compile/internal/noder/helpers.go
+++ b/src/cmd/compile/internal/noder/helpers.go
@@ -79,9 +79,7 @@ func Call(pos src.XPos, fun ir.Node, args []ir.Node, dots bool) ir.Node {
}
}
- // We probably already typechecked fun, and typecheck probably
- // got it wrong because it didn't know the expression was
- // going to be called immediately. Correct its mistakes.
+ // Add information, now that we know that fun is actually being called.
switch fun := fun.(type) {
case *ir.ClosureExpr:
fun.Func.SetClosureCalled(true)
@@ -92,6 +90,8 @@ func Call(pos src.XPos, fun ir.Node, args []ir.Node, dots bool) ir.Node {
op = ir.ODOTINTER
}
fun.SetOp(op)
+ // Set the type to include the receiver, since that's what
+ // later parts of the compiler expect
fun.SetType(fun.Selection.Type)
}
}