compiler: do not panic on duplicate functions

Instead, show a regular error message. This is much more user-friendly.
This commit is contained in:
Ayke van Laethem
2019-06-06 12:07:59 +02:00
committed by Ron Evans
parent 776dc1e0d9
commit ec87811420
+2 -1
View File
@@ -826,7 +826,8 @@ func (c *Compiler) parseFunc(frame *Frame) {
fmt.Printf("\nfunc %s:\n", frame.fn.Function)
}
if !frame.fn.LLVMFn.IsDeclaration() {
panic("function is already defined: " + frame.fn.LLVMFn.Name())
c.addError(frame.fn.Pos(), "function is already defined:"+frame.fn.LLVMFn.Name())
return
}
if !frame.fn.IsExported() {
frame.fn.LLVMFn.SetLinkage(llvm.InternalLinkage)