Skip to content

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Dec 13, 2021

Now that ES6 features are permitted in emscripten JS library
code (see #15763) we can take advantage of some of them to
reduce size of our output JS.

This is just an initial test of using ES6 features.

See: #11984

@sbc100 sbc100 force-pushed the initial_es6 branch 2 times, most recently from 3c9d594 to bd2e5c6 Compare December 15, 2021 02:04
@sbc100 sbc100 force-pushed the use_es6 branch 3 times, most recently from a791242 to f16903e Compare December 18, 2021 03:00
@sbc100 sbc100 changed the base branch from initial_es6 to main December 18, 2021 03:01
@sbc100 sbc100 changed the title [WIP] Initial usage of arrow function (=>) in JS library code Initial usage of IES in JS library code Dec 18, 2021
@sbc100 sbc100 requested review from dschuff, juj and kripken December 18, 2021 04:14
@sbc100 sbc100 changed the title Initial usage of IES in JS library code Initial usage of ES6 in JS library code Dec 20, 2021
Copy link
Member

@tlively tlively left a comment

Choose a reason for hiding this comment

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

Nice!

f = re.sub(r'\s*function\s*\(Module\)\s*{\s*Module\s*=\s*Module\s*\|\|\s*{\s*}\s*;\s*var\s+(\w+)\s*=\s*Module\s*;', r'function(\1){', f)

# Same as above but for arrow function
f = re.sub(r'\s*\(Module\)\s*=>\s*{\s*Module\s*=\s*Module\s*\|\|\s*{\s*}\s*;\s*var\s+(\w+)\s*=\s*Module\s*;', r'(\1)=>{', f)
Copy link
Member

Choose a reason for hiding this comment

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

Is there a test that exercises this?

Copy link
Collaborator Author

@sbc100 sbc100 Dec 20, 2021

Choose a reason for hiding this comment

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

Yes, without this there is a test that fails... i don't remember which one I'm afraid.

Now that ES6 features are permitted in emscripten JS library
code (see #15763) we can take advantage of some of them to
reduce size of our output JS.

This is just an initial test of using ES6 features.

See: #11984
@sbc100 sbc100 enabled auto-merge (squash) December 20, 2021 21:16
@sbc100 sbc100 merged commit 8e1e305 into main Dec 21, 2021
@sbc100 sbc100 deleted the use_es6 branch December 21, 2021 18:51
mmarczell-graphisoft pushed a commit to GRAPHISOFT/emscripten that referenced this pull request Jan 5, 2022
Now that ES6 features are permitted in emscripten JS library
code (see emscripten-core#15763) we can take advantage of some of them to
reduce size of our output JS.

This is just an initial test of using ES6 features.

See: emscripten-core#11984
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.

3 participants