Skip to content

Conversation

andy-hanson
Copy link
Contributor

I noticed that queuedImports is never looked at again after this loop. Since queuedImports.splice(i, 1) is equivalent to i++ if we don't care about the state of queuedImports after the loop, we can just convert this to an ordinary for-of loop.
As of this PR, queuedImports is only referenced twice: once to write to in initializeImports, and once to loop over here.

// queued imports should be resolvable now through traversing exports and queued exports
for (let i = 0; i < queuedImports.length;) {
let queuedImport = queuedImports[i];
for (const queuedImport of queuedImports) {
Copy link
Member

Choose a reason for hiding this comment

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

Looks good, but can we keep the plain for-loop here? Just to be sure, because for-of isn't yet supported when compiling to WASM (somewhat due to the lack of iterators), even though we don't compile the compiler itself to WASM yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What to do about for-of loops over maps?

@andy-hanson
Copy link
Contributor Author

This PR subsumed by #249 anyway.

@andy-hanson andy-hanson closed this Sep 9, 2018
@andy-hanson andy-hanson deleted the queuedImports_splice branch September 9, 2018 17:15
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.

2 participants