aDotInTheVoid / skate

Skateboard for the mind
Apache License 2.0
2 stars 0 forks source link

Block Scope #36

Closed aDotInTheVoid closed 3 years ago

aDotInTheVoid commented 3 years ago

currently on a block, we reuse the previous scope.

fn main() {
    let x = 2;
    {
        let x = 3;
        print x;
    };
    // TODO: Should be 2
    print x;
}

outputs

3
3

should be

2
3

https://github.com/aDotInTheVoid/skate/blob/c3e331b0d949cd2fc83fe1cd04b0d7509b4b9643/src/exec.rs#L231-L234

We need to introduce a new scope, and then do fallback