Fix couple of linting problems
This commit is contained in:
parent
2d7a32bcf3
commit
3904d6ef74
|
@ -27,6 +27,7 @@ import (
|
|||
)
|
||||
|
||||
var builtinSource *Source
|
||||
var OutOfRangeLine string = "----"
|
||||
|
||||
type Source struct {
|
||||
// A Pointer to the buffer where the parser used for parsing the source
|
||||
|
@ -59,7 +60,7 @@ func (s *Source) GetLine(linenum int) string {
|
|||
if linenum > 0 && linenum <= len(lines) {
|
||||
return lines[linenum-1]
|
||||
}
|
||||
return "----"
|
||||
return OutOfRangeLine
|
||||
}
|
||||
|
||||
// LineNumberFor returns the line number associated with the given position `pos` in
|
||||
|
|
|
@ -78,10 +78,11 @@ func REPL(flags map[string]bool) {
|
|||
EOFPrompt: "exit",
|
||||
HistorySearchFold: true,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
}
|
||||
|
||||
rl.HistoryEnable()
|
||||
defer rl.Close()
|
||||
|
||||
|
@ -108,7 +109,6 @@ for details take a look at the LICENSE file.
|
|||
}
|
||||
rep(rt, line)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func Run(flags map[string]bool, args []string) {
|
||||
|
@ -121,7 +121,6 @@ func Run(flags map[string]bool, args []string) {
|
|||
rt.CreateNS("serene.internal", "RUN", true)
|
||||
|
||||
if len(args) == 0 {
|
||||
|
||||
PrintError(rt, MakePlainError("'run' command needs at least one argument"))
|
||||
os.Exit(1)
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/gookit/color"
|
||||
"serene-lang.org/bootstrap/pkg/ast"
|
||||
"serene-lang.org/bootstrap/pkg/errors"
|
||||
)
|
||||
|
||||
|
@ -149,7 +150,7 @@ func frameSource(traces *TraceBack, frameIndex int) string {
|
|||
|
||||
if fLoc.IsKnownLocaiton() {
|
||||
line := fLoc.GetSource().GetLine(i)
|
||||
if line != "----" {
|
||||
if line != ast.OutOfRangeLine {
|
||||
lines += fmt.Sprintf("%d:\t%s\n", i, line)
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue