PlayWithCompiler
PlayWithCompiler copied to clipboard
这里的打印结果应该是 0
https://github.com/RichardGong/PlayWithCompiler/blob/d51caeb2859065f938e91615a75f7cca53404089/playscript-java/src/examples/BlockScope.play#L20
因为在 type resolve 阶段已经把所有的变量定义都识别出来了,然后在 ref resolve 阶段解决分号中第一个 i 的引用时会在当前作用域中寻找到,所以分号中对 i 的赋值不会影响到根作用域的变量 i。运行了一下程序确实如此。