compiler: do not panic on duplicate functions
Instead, show a regular error message. This is much more user-friendly.
Этот коммит содержится в:
родитель
776dc1e0d9
коммит
ec87811420
1 изменённых файлов: 2 добавлений и 1 удалений
|
@ -826,7 +826,8 @@ func (c *Compiler) parseFunc(frame *Frame) {
|
||||||
fmt.Printf("\nfunc %s:\n", frame.fn.Function)
|
fmt.Printf("\nfunc %s:\n", frame.fn.Function)
|
||||||
}
|
}
|
||||||
if !frame.fn.LLVMFn.IsDeclaration() {
|
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() {
|
if !frame.fn.IsExported() {
|
||||||
frame.fn.LLVMFn.SetLinkage(llvm.InternalLinkage)
|
frame.fn.LLVMFn.SetLinkage(llvm.InternalLinkage)
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче