Skip to content

Commit 6af27c4

Browse files
mdempskygopherbot
authored andcommitted
cmd/compile/internal/typecheck: more selective OPAREN skipping
Move the OPAREN skipping logic from typecheck into typecheck1, so that it only applies to ParenExprs with Typecheck()==0. This should allow CL 567695 to be re-landed, which uses ParenExprs as placeholders in the AST. Fixes #66261. Change-Id: I606b7bad0cf1c0447e60d6da68d1d66db00863f7 Reviewed-on: https://go-review.googlesource.com/c/go/+/573095 Auto-Submit: Matthew Dempsky <[email protected]> Reviewed-by: Than McIntosh <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 334835e commit 6af27c4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/cmd/compile/internal/typecheck/typecheck.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,6 @@ func typecheck(n ir.Node, top int) (res ir.Node) {
160160
lno := ir.SetPos(n)
161161
defer func() { base.Pos = lno }()
162162

163-
// Skip over parens.
164-
for n.Op() == ir.OPAREN {
165-
n = n.(*ir.ParenExpr).X
166-
}
167-
168163
// Skip typecheck if already done.
169164
// But re-typecheck ONAME/OTYPE/OLITERAL/OPACK node in case context has changed.
170165
if n.Typecheck() == 1 || n.Typecheck() == 3 {
@@ -216,6 +211,11 @@ func indexlit(n ir.Node) ir.Node {
216211

217212
// typecheck1 should ONLY be called from typecheck.
218213
func typecheck1(n ir.Node, top int) ir.Node {
214+
// Skip over parens.
215+
for n.Op() == ir.OPAREN {
216+
n = n.(*ir.ParenExpr).X
217+
}
218+
219219
switch n.Op() {
220220
default:
221221
ir.Dump("typecheck", n)

0 commit comments

Comments
 (0)