Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module evaluate will return evaluating status. #3512

Open
LMM-7xyx opened this issue Dec 26, 2024 · 3 comments
Open

Module evaluate will return evaluating status. #3512

LMM-7xyx opened this issue Dec 26, 2024 · 3 comments

Comments

@LMM-7xyx
Copy link

LMM-7xyx commented Dec 26, 2024

Description:
case:

// main.mjs
import { a }  from './A.mjs'  // error module
console.log(a);

Assume that A.mjs file will throw error and it already evaluated, so module A's EvaluationError is not empty.

The main.mjs starts execution as the root node, and the execution order should be A -> main. Since A.mjs has EvaluationError, it will return in
"3. If requiredModule.[[EvaluationError]] is not empty, return ? requiredModule.[[EvaluationError]]."

Image

At this time, evaluate stack is not empty(remians main.mjs), but in InnerModuleEvaluation has no exception, and module main.mjs status is evaluating, not satisfied with 'a. Assert: module.[[Status]] is either evaluating-async or evaluated.'.

Image
Image

Error happens here. Module main is still evaluating without exception. There is no branch handle this situation.

eshost Output:

now: if A occurs error before, module main.mjs will return with evaluating status without exception. There is no branch handle this situation.

@nicolo-ribaudo
Copy link
Member

[[EvaluationError]], if not empty, always contains a throw completion. So that line 11.c.iv.3 will return a throw completion, which will bubble up to Evaluate and then go through step 9 of it, not 10.

@LMM-7xyx
Copy link
Author

Sorry, I still confuse.
If A already evaluated by dynamicImport, marked [[EvaluationError]], throw completion and return.
Then dynamicimport main.mjs, it will return in check A's status, but A won't throw completion.

@nicolo-ribaudo
Copy link
Member

That "return ? requiredModule.[[EvaluationError]]` means:

  1. If requiredModule.[[EvaluationError]] is a throw completion, throw requiredModule.[[EvaluationError]].
  2. Else, return requiredModule.[[EvaluationError]].

So it throws.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants