Skip to content

Commit c5d1a98

Browse files
committed
fix: adjust semantic error handling condition in Run API
Modify the error checking logic to ensure semantic errors are properly handled when resolving statements
1 parent e19f60c commit c5d1a98

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/lox/api/run_api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func Run(source string) (string, int, string) {
1616
parser := lox.NewParser(tokens)
1717
statements := parser.Parse(mockStdout, mockStderr)
1818
locals, err := lox.Resolve(statements)
19-
if err != nil || lox.HadSemanticError {
19+
if err != nil && lox.HadSemanticError {
2020
return "", 65, err.Error()
2121
}
2222
lox.Interpret(statements, locals, mockStdout, mockStderr)

0 commit comments

Comments
 (0)