From 1ddacfea7ba35c5ecbe75b2598c92f6349011ba3 Mon Sep 17 00:00:00 2001 From: griesemer Date: Fri, 6 Oct 2017 16:44:12 -0700 Subject: [PATCH] cmd/compile/internal/syntax: remove unused code Change-Id: I9c75dee7e4498cc11c08cad1ae34ff2af75f1469 Reviewed-on: https://go-review.googlesource.com/69071 Reviewed-by: Matthew Dempsky --- src/cmd/compile/internal/syntax/parser.go | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/cmd/compile/internal/syntax/parser.go b/src/cmd/compile/internal/syntax/parser.go index b9129b0d9c..f910052697 100644 --- a/src/cmd/compile/internal/syntax/parser.go +++ b/src/cmd/compile/internal/syntax/parser.go @@ -1171,22 +1171,6 @@ func (p *parser) interfaceType() *InterfaceType { return typ } -// FunctionBody = Block . -func (p *parser) funcBody() []Stmt { - if trace { - defer p.trace("funcBody")() - } - - p.fnest++ - body := p.stmtList() - p.fnest-- - - if body == nil { - body = []Stmt{new(EmptyStmt)} - } - return body -} - // Result = Parameters | Type . func (p *parser) funcResult() []*Field { if trace { @@ -1676,6 +1660,11 @@ func (p *parser) blockStmt(context string) *BlockStmt { defer p.trace("blockStmt")() } + // TODO(gri) If we are in a function we should update p.fnest + // accordingly. Currently p.fnest is always zero and thus not + // used in error recovery. + // Not enabled for for because it performs worse for some code + // without more fine tuning (see example in #22164). s := new(BlockStmt) s.pos = p.pos() -- 2.48.1