Commit 0dafb7d9 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

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: 's avatarMatthew Dempsky <mdempsky@google.com>
parent 49a533e2
......@@ -319,6 +319,10 @@ func (p *noder) funcDecl(fun *syntax.FuncDecl) *Node {
funcbody(f)
if f.Nbody.Len() == 0 && (pure_go || strings.HasPrefix(f.Func.Nname.Sym.Name, "init.")) {
yyerrorl(f.Pos, "missing function body for %q", f.Func.Nname.Sym.Name)
}
return f
}
......
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment