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

Specifying JSON modules #53

Merged
merged 2 commits into from
May 11, 2020
Merged

Specifying JSON modules #53

merged 2 commits into from
May 11, 2020

Conversation

littledan
Copy link
Member

@littledan littledan commented May 8, 2020

This PR also fixes #52

<p>The abstract operation ParseJSONModule takes a single argument _source_ which is a String representing the contents of a module.</p>

<emu-alg>
1. Let _json_ be ? Call(%JSONParse%, *undefined*, « _source_ »). <!-- TODO: Refactor JSONParse into an abstract algorithm -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the JSON be frozen? What if a developer accidentally call the json.arr.sort() then the file is corrupted

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's discuss this in a separate issue: https://github.com/tc39/proposal-module-attributes/issues/54

1. Perform ! HostImportModuleDynamically(_referencingScriptOrModule_, _specifierString_, <ins>_attr_,</ins> _promiseCapability_).
1. <ins>Let _argRef_ be the result of evaluating the second |AssignmentExpression|.</ins>
1. <ins>Let _arg_ be ? GetValue(_argRef_).</ins>
1. <ins>If _arg_ is *undefined*, let _attributes_ be *undefined*.</ins>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this PR also fixes #52 .

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, added to the commit message.

@littledan
Copy link
Member Author

I'm going to land this PR; review comments still welcome.

@littledan littledan merged commit 58f2d6e into master May 11, 2020
@littledan littledan deleted the with-type-json-spec branch May 11, 2020 10:41
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

Successfully merging this pull request may close these issues.

Should undefined allowed in second assignment of import call?
3 participants