cmd/compile: check for missing function body earlier

Tested by fixedbugs/issue3705.go.

This removes a dependency on lineno
from near the backend.

Change-Id: I228bd0ad7295cf881b9bdeb0df9d18483fb96821
Reviewed-on: https://go-review.googlesource.com/38382
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Josh Bleecher Snyder 2017-03-20 13:16:07 -07:00
parent 49a533e212
commit 0dafb7d962
2 changed files with 4 additions and 6 deletions

View file

@ -12,7 +12,6 @@ import (
"cmd/internal/sys"
"fmt"
"sort"
"strings"
)
// "Portable" code generation.
@ -278,11 +277,6 @@ func compile(fn *Node) {
dowidth(fn.Type)
if fn.Nbody.Len() == 0 {
if pure_go || strings.HasPrefix(fn.Func.Nname.Sym.Name, "init.") {
yyerror("missing function body for %q", fn.Func.Nname.Sym.Name)
return
}
emitptrargsmap()
return
}