Skip to content

import defer testing plan #4215

Open
Open
@nicolo-ribaudo

Description

https://github.com/tc39/proposal-defer-import-eval/

Syntax

Valid cases

import defer * as ns from "mod";
import defer from "mod";
import defer * as ns from "mod";
export { ns };

Invalid cases (one per file)

import defer x from "mod";
import defer { x } from "mod";
import defer y, * as ns from "mod";
import defer as ns from "mod";
export defer * as ns from "mod";

Deferred namespace object

  • It is an object
  • It is not the same object as the non-deferred one
  • Importing twice gives the same object
    • static/static
    • static/dynamic
    • dynamic/dynamic
    • static from different files
  • import and import defer + exec only execute the module once
  • @@toStringTag (Add test for @@toStringTag on deferred module namespaces #4360)

Evaluation

Sync

Errors

  • Property access re-throws the evaluation error
    • On first access for not evaluated modules
    • On second access for not evaluated modules
    • On first access for already evaluated modules
  • Import defer of an errored module doesn't throw
  • ReadyForSyncExecution
    • Cannot evaluate a module in its evaluating state
    • Cannot evaluate itself
    • Cannot evaluate a module with a dependency in an evaluating state
    • The error when evaluating a module with two dependencies, where the first one is linked and the second one is evaluating, happens before evaluating the first one
    • A deferred module evaluates itself while being deferred-evaluated
    • Cannot evaluate a module in its evaluating-async state
    • Cannot evaluate itself after a TLA
    • Cannot evaluate a module with a dependency in an evaluating-async state.
  • Syntax error are not deferred
  • Linking errors are not deferred

Async

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions