compiler: return error messages with source location

Replace most errors returned by the compiler (using errors.New) with an
error type that includes the source location.
This commit is contained in:
Ayke van Laethem
2018-12-01 17:19:40 +01:00
parent 7bdb606d4f
commit da0a02d128
5 changed files with 86 additions and 69 deletions
+14
View File
@@ -0,0 +1,14 @@
package compiler
import (
"go/token"
"go/types"
)
func (c *Compiler) makeError(pos token.Pos, msg string) types.Error {
return types.Error{
Fset: c.ir.Program.Fset,
Pos: pos,
Msg: msg,
}
}