mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:07:45 +00:00
LibJS: Make indirect bindings of module behave like normal bindings
Before this we attempted to hack around this by only overriding has_binding. However this did not cover all cases, for example when assigning to variables before their declaration it didn't throw. By using the new find_binding_and_index virtual method we can just pretend the indirect bindings are real. Since indirect binding do come from a normal environment we need to ensure you cannot modify the binding and that properties like mutable are false as expected by the spec for such an indirect binding.
This commit is contained in:
parent
2484bbc4e0
commit
0fc67ffd62
5 changed files with 85 additions and 17 deletions
|
@ -194,6 +194,14 @@ describe("in- and exports", () => {
|
|||
test("can export namespace via binding", () => {
|
||||
expectModulePassed("./re-export-namespace-via-binding.mjs");
|
||||
});
|
||||
|
||||
test("import variable before import statement behaves as undefined and non mutable variable", () => {
|
||||
expectModulePassed("./accessing-var-import-before-decl.mjs");
|
||||
});
|
||||
|
||||
test("import lexical binding before import statement behaves as initialized but non mutable binding", () => {
|
||||
expectModulePassed("./accessing-lex-import-before-decl.mjs");
|
||||
});
|
||||
});
|
||||
|
||||
describe("loops", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue