mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 03:27:48 +00:00
compiler: do not panic on duplicate functions
Instead, show a regular error message. This is much more user-friendly.
This commit is contained in:
committed by
Ron Evans
parent
776dc1e0d9
commit
ec87811420
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user