mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-15 00:13:43 +00:00
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:
@@ -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,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user