Compiler has bug() to wrap unexpected errors
This commit is contained in:
parent
d5bb1be894
commit
5e740ebf5f
@ -24,7 +24,7 @@ func (this *Compiler) CompileUnit (address entity.Address) error {
|
|||||||
|
|
||||||
irModule, err := native.NativeTarget().Generate(semanticTree)
|
irModule, err := native.NativeTarget().Generate(semanticTree)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New(fmt.Sprintf("internal errror: %v", err))
|
return this.bug(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the format isn't specified, try to get it from the filename
|
// if the format isn't specified, try to get it from the filename
|
||||||
|
@ -23,6 +23,17 @@ type Compiler struct {
|
|||||||
Format string
|
Format string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Compiler) bug (err error) error {
|
||||||
|
return errors.New(fmt.Sprintln (
|
||||||
|
"Bug detected in the compiler!\n" +
|
||||||
|
"The FSPL compiler has experienced an error that should not",
|
||||||
|
"happen.\n" +
|
||||||
|
"Please submit a report with this info and the code you were",
|
||||||
|
"compiling to:",
|
||||||
|
"https://git.tebibyte.media/sashakoshka/fspl/issues\n" +
|
||||||
|
"The error is:", err))
|
||||||
|
}
|
||||||
|
|
||||||
func (this *Compiler) AnalyzeUnit (
|
func (this *Compiler) AnalyzeUnit (
|
||||||
semanticTree *analyzer.Tree,
|
semanticTree *analyzer.Tree,
|
||||||
path string,
|
path string,
|
||||||
|
Loading…
Reference in New Issue
Block a user