feat: implement import.defer() and import.source() dynamic import syntax#5035
Merged
jedel1043 merged 4 commits intoboa-dev:mainfrom Mar 15, 2026
Merged
Conversation
Test262 conformance changes
Fixed tests (135):Tested main commit: |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5035 +/- ##
===========================================
+ Coverage 47.24% 59.11% +11.86%
===========================================
Files 476 563 +87
Lines 46892 62665 +15773
===========================================
+ Hits 22154 37042 +14888
- Misses 24738 25623 +885 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c8e5c8e to
a97e051
Compare
jedel1043
requested changes
Mar 13, 2026
a97e051 to
0658b5b
Compare
Add parsing and runtime support for import.defer(specifier) and import.source(specifier) dynamic import syntax. Changes: - Add ImportPhase enum (Evaluation, Defer, Source) to boa_ast - Extend parser to detect and parse import.defer() and import.source() - Thread phase through bytecode compiler as IndexOperand - Update VM ImportCall handler to decode phase operand - Source phase: reject with SyntaxError per GetModuleSource() spec - Defer phase: proceed with standard evaluation semantics - Remove source-phase-imports from ignored features Note: import-defer remains in the ignored features list since full deferred evaluation semantics (deferred namespace objects, evaluation triggers) are not yet implemented.
0658b5b to
bf0a96e
Compare
jedel1043
requested changes
Mar 15, 2026
Address review feedback: - Add 'defer' and 'source' to static_syms! for compile-time Sym constants - Simplify is_keyword_call to only detect keyword( patterns - Add separate is_import_phase_call helper using Sym::DEFER/Sym::SOURCE - Restructure let-else chain into distinct branches for import( vs import.defer(/import.source(
jedel1043
approved these changes
Mar 15, 2026
Member
jedel1043
left a comment
There was a problem hiding this comment.
Yep, looks great! Thank you!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Pull Request adds parsing and runtime support for
import.defer()andimport.source()dynamic import syntax, enabling 64 previously-ignored test262 tests.It changes the following:
ImportPhaseenum (Evaluation,Defer,Source) and aphasefield to theImportCallAST node incore/ast/src/expression/call.rs, with properToInternedStringoutput for each phase.core/parser/src/parser/expression/left_hand_side/mod.rsto detect and parseimport.defer(expr)andimport.source(expr)syntax, including 4-token lookahead inis_keyword_calland phase-aware token consumption.core/engine/src/bytecompiler/expression/mod.rsto encodeImportPhaseas anIndexOperand(0=evaluation, 1=defer, 2=source) on theImportCallinstruction.phase: IndexOperandto theImportCallopcode definition incore/engine/src/vm/opcode/mod.rsand updated the code block display incore/engine/src/vm/code_block.rsto show phase names.ImportCallhandler incore/engine/src/vm/opcode/call/mod.rsto decode the phase operand: source phase rejects withSyntaxErrorperGetModuleSource()spec (16.2.1.7.2), defer phase uses standard evaluation semantics.import-deferandsource-phase-importsfrom the ignored features list intest262_config.toml, bringingdynamic-import/catchsuite from 112/176 to 176/176 (100% conformance).