LibJS: Fix mix-up when re-exporting an imported symbol with a new name

This makes https://cling.com/ load, and more of the animated elements
on https://shopify.com/ start appearing.
This commit is contained in:
Andreas Kling 2024-09-02 16:24:09 +02:00 committed by Andreas Kling
parent 427e6cec7b
commit 0f9444fa06
Notes: github-actions[bot] 2024-09-02 15:15:16 +00:00
5 changed files with 19 additions and 1 deletions

View file

@ -0,0 +1 @@
PASS: 123

View file

@ -0,0 +1,2 @@
var value = 123;
export { value };

View file

@ -0,0 +1,2 @@
import { value } from "./js-export-rename-helper.js";
export { value as renamedValue };

View file

@ -0,0 +1,13 @@
<script src="include.js"></script>
<script>
window.resultThingy = "FAIL";
</script>
<script type="module">
import { renamedValue } from "./js-export-rename-module.js";
window.resultThingy = "PASS: " + renamedValue;
</script>
<script>
test(() => {
println(resultThingy);
});
</script>

View file

@ -217,7 +217,7 @@ Result<NonnullGCPtr<SourceTextModule>, Vector<ParserError>> SourceTextModule::pa
else {
// a. NOTE: This is a re-export of a single name.
// b. Append the ExportEntry Record { [[ModuleRequest]]: ie.[[ModuleRequest]], [[ImportName]]: ie.[[ImportName]], [[LocalName]]: null, [[ExportName]]: ee.[[ExportName]] } to indirectExportEntries.
indirect_export_entries.empend(ExportEntry::indirect_export_entry(import_entry.module_request(), import_entry.import_name, export_entry.export_name));
indirect_export_entries.empend(ExportEntry::indirect_export_entry(import_entry.module_request(), export_entry.export_name, import_entry.import_name));
}
}
}