tdp2110 / crafting-interpreters-rs

Crafting Interpreters in Rust
Boost Software License 1.0
259 stars 12 forks source link

error in treewalk interpreter #9

Closed tdp2110 closed 3 years ago

tdp2110 commented 3 years ago

Consider f.lox

fun a() { b(); }
fun b() { c(); }
fun c() {
  c("too", "many");
}

a()

It should give a runtime error for the call to c on line 4, but this gives:

cargo run --release --quiet -- f.lox  --treewalk
Treewalk Interpreter Error: Use of undefined variable b at line=1,col=10.
Note: b was never declared.