mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 21:43:40 +00:00
transform: replace panics with source locations
Panics are bad for usability: whenever something breaks, the user is shown a (not very informative) backtrace. Replace it with real error messages instead, that even try to display the Go source location.
This commit is contained in:
committed by
Ron Evans
parent
25fcf3e18e
commit
26aba72729
@@ -75,7 +75,10 @@ func Optimize(mod llvm.Module, config *compileopts.Config, optLevel, sizeLevel i
|
||||
OptimizeMaps(mod)
|
||||
OptimizeStringToBytes(mod)
|
||||
OptimizeAllocs(mod)
|
||||
LowerInterfaces(mod)
|
||||
err := LowerInterfaces(mod)
|
||||
if err != nil {
|
||||
return []error{err}
|
||||
}
|
||||
|
||||
errs := LowerInterrupts(mod)
|
||||
if len(errs) > 0 {
|
||||
@@ -115,7 +118,10 @@ func Optimize(mod llvm.Module, config *compileopts.Config, optLevel, sizeLevel i
|
||||
|
||||
} else {
|
||||
// Must be run at any optimization level.
|
||||
LowerInterfaces(mod)
|
||||
err := LowerInterfaces(mod)
|
||||
if err != nil {
|
||||
return []error{err}
|
||||
}
|
||||
if config.FuncImplementation() == compileopts.FuncValueSwitch {
|
||||
LowerFuncValues(mod)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user