lang: ast: Provide better error reporting for scope errors

Print these file and line numbers when we can!
This commit is contained in:
James Shubin
2025-06-05 23:00:56 -04:00
parent 75bafa4fd3
commit dcd4f0709f
2 changed files with 23 additions and 5 deletions

View File

@@ -562,6 +562,19 @@ func lambdaScopeFeedback(scope *interfaces.Scope, logf func(format string, v ...
}
}
// highlightHelper give the user better file/line number feedback.
func highlightHelper(node interfaces.Node, logf func(format string, v ...interface{}), err error) error {
displayer, ok := node.(interfaces.TextDisplayer)
if ok {
if highlight := displayer.HighlightText(); highlight != "" {
logf("%s: %s", err.Error(), highlight)
}
//return fmt.Errorf("%s: %s", err.Error(), displayer.Byline())
}
return err
}
// Textarea stores the coordinates of a statement or expression in the form of a
// starting line/column and ending line/column.
type Textarea struct {