diff options
Diffstat (limited to 'vendor/github.com/d5/tengo/compiler/error.go')
-rw-r--r-- | vendor/github.com/d5/tengo/compiler/error.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/vendor/github.com/d5/tengo/compiler/error.go b/vendor/github.com/d5/tengo/compiler/error.go new file mode 100644 index 00000000..6ac33d42 --- /dev/null +++ b/vendor/github.com/d5/tengo/compiler/error.go @@ -0,0 +1,20 @@ +package compiler + +import ( + "fmt" + + "github.com/d5/tengo/compiler/ast" + "github.com/d5/tengo/compiler/source" +) + +// Error represents a compiler error. +type Error struct { + fileSet *source.FileSet + node ast.Node + error error +} + +func (e *Error) Error() string { + filePos := e.fileSet.Position(e.node.Pos()) + return fmt.Sprintf("Compile Error: %s\n\tat %s", e.error.Error(), filePos) +} |