munificent / craftinginterpreters

Repository for the book "Crafting Interpreters"
http://www.craftinginterpreters.com/
Other
8.87k stars 1.04k forks source link

Interpreter: removed need for null check in regards to variable declarations. #1100

Closed h2oboi89 closed 1 year ago

h2oboi89 commented 1 year ago

for cases of var a; where no initializer is given I sneak in a dummy new Expr.Literal(null) to give Interpreter.visitVarStmt something to chew on via Interpreter.evaluate(Expr expr) instead of having to do a check for null.

Pros:

Cons: