Replace the linked-list Scope structure with a flat Local array indexed by depth, enabling proper shadowing semantics where inner declarations correctly hide outer ones. Remove the PUSH_SCOPE/POP_SCOPE macros and the SymbolTable-based locals tracking, replacing them with a MAX_LOCALS (255) fixed-size array that stores variable name, length, and depth. Add four new test cases covering local/parameter collision, nested block scoping, global shadowing, and local shadowing to validate the new behavior.
6 lines
64 B
Plaintext
6 lines
64 B
Plaintext
class Foo {
|
|
bar(a) {
|
|
var a = "oops" // expect error
|
|
}
|
|
}
|