aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types/size.go
diff options
context:
space:
mode:
authorDan Scales <danscales@google.com>2021-01-28 17:43:18 -0800
committerDan Scales <danscales@google.com>2021-01-30 00:42:35 +0000
commit0aafd6912422570625414da6e5ed5ba2c371fcec (patch)
tree27788ad91dbfa27bbfbbe2239bd1c31aad2b8714 /src/cmd/compile/internal/types/size.go
parenta59cb5109d49ac0dc09337449b9c7760ecc66c0e (diff)
downloadgo-0aafd6912422570625414da6e5ed5ba2c371fcec.tar.gz
go-0aafd6912422570625414da6e5ed5ba2c371fcec.zip
[dev.typeparams] cmd/compile: start translating type params in noder2
Also, make some fmt changes so that the type parameters and the typeparam type are displayed in -W=2. You can now parse a simple generic function (but not generic calls or generic types) and print out the noder IR via 'go tool compile -G=2 -W=2 func.go' Change-Id: I1f070fc4a96174a447763ad37999e61c25905901 Reviewed-on: https://go-review.googlesource.com/c/go/+/287833 Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Dan Scales <danscales@google.com> Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/types/size.go')
-rw-r--r--src/cmd/compile/internal/types/size.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/types/size.go b/src/cmd/compile/internal/types/size.go
index 98540eefb6..d1203e4a21 100644
--- a/src/cmd/compile/internal/types/size.go
+++ b/src/cmd/compile/internal/types/size.go
@@ -499,6 +499,11 @@ func CalcSize(t *Type) {
base.Warn("bad type %v %d\n", t1, w)
}
t.Align = 1
+
+ case TTYPEPARAM:
+ // TODO(danscales) - remove when we eliminate the need
+ // to do CalcSize in noder2 (which shouldn't be needed in the noder)
+ w = int64(PtrSize)
}
if PtrSize == 4 && w != int64(int32(w)) {