aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/dcl.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-01-09 00:57:55 -0800
committerMatthew Dempsky <mdempsky@google.com>2021-01-14 02:07:48 +0000
commitef5285fbd0636965d916c81dbf87834731f337b2 (patch)
tree005d62b2e4f8bb7373b93d467fb749696d23ef66 /src/cmd/compile/internal/typecheck/dcl.go
parentf065ff221b546c9ac550d947f89eb3b44b11fc2f (diff)
downloadgo-ef5285fbd0636965d916c81dbf87834731f337b2.tar.gz
go-ef5285fbd0636965d916c81dbf87834731f337b2.zip
[dev.typeparams] cmd/compile: add types2-based noder
This CL adds "irgen", a new noding implementation that utilizes types2 to guide IR construction. Notably, it completely skips dealing with constant and type expressions (aside from using ir.TypeNode to interoperate with the types1 typechecker), because types2 already handled those. It also omits any syntax checking, trusting that types2 already rejected any errors. It currently still utilizes the types1 typechecker for the desugaring operations it handles (e.g., turning OAS2 into OAS2FUNC/etc, inserting implicit conversions, rewriting f(g()) functions, and so on). However, the IR is constructed in a fully incremental fashion, so it should be easy to now piecemeal replace those dependencies as needed. Nearly all of "go test std cmd" passes with -G=3 enabled by default. The main remaining blocker is the number of test/run.go failures. There also appear to be cases where types2 does not provide us with position information. These will be iterated upon. Portions and ideas from Dan Scales's CL 276653. Change-Id: Ic99e8f2d0267b0312d30c10d5d043f5817a59c9d Reviewed-on: https://go-review.googlesource.com/c/go/+/281932 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com> Reviewed-by: Robert Griesemer <gri@golang.org> Trust: Matthew Dempsky <mdempsky@google.com> Trust: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/dcl.go')
-rw-r--r--src/cmd/compile/internal/typecheck/dcl.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/typecheck/dcl.go b/src/cmd/compile/internal/typecheck/dcl.go
index c7d7506fd1..bd54919c93 100644
--- a/src/cmd/compile/internal/typecheck/dcl.go
+++ b/src/cmd/compile/internal/typecheck/dcl.go
@@ -304,10 +304,13 @@ func checkembeddedtype(t *types.Type) {
}
}
-func fakeRecvField() *types.Field {
+// TODO(mdempsky): Move to package types.
+func FakeRecv() *types.Field {
return types.NewField(src.NoXPos, nil, types.FakeRecvType())
}
+var fakeRecvField = FakeRecv
+
var funcStack []funcStackEnt // stack of previous values of Curfn/dclcontext
type funcStackEnt struct {