Skip to content

Conversation

@tcare
Copy link
Contributor

@tcare tcare commented Feb 9, 2018

We were mistakenly marking both the class let and const decls as module export storage. This resulted in empty instantiated scopes and incorrect class behavior in some cases.

The fix is not to mark the const binding as module export storage, as it is visible to the inside of the class only.

Added some tests to verify the bindings of exported classes.

@tcare tcare requested review from boingoing and pleath February 9, 2018 01:03
@tcare tcare force-pushed the classexport branch 3 times, most recently from 0b3c5a8 to f3179db Compare February 9, 2018 01:11
Copy link
Contributor

@boingoing boingoing left a comment

Choose a reason for hiding this comment

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

Nice fix and good test coverage

assert.areEqual(true, A2Inst.bindingModified(), 'Captured class name observes mutation');
assert.throws(function () { A2Inst.attemptBindingChange(); }, TypeError, 'Delay exported class name captured in class is still const', "Assignment to const");

export let B1 = class B1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like one more set of these if you don't mind where the let binding name is different from the class expression name. export let C1 = class NotC1 { for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Also fixed my conditional language which was inverted :)

…module export storage

We were mistakenly marking both the class let and const decls as module export storage. This resulted in empty instantiated scopes and incorrect class behavior in some cases.

The fix is not to mark the const binding as module export storage, as it is visible to the inside of the class only.

Added some tests to verify the bindings of exported classes.
@dilijev
Copy link
Contributor

dilijev commented Feb 9, 2018

Should there be a test of what is/is not observable from the site where the module is loaded?

Copy link
Contributor

@dilijev dilijev left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@pleath pleath left a comment

Choose a reason for hiding this comment

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

Well, gee, that was easy. :)

@chakrabot chakrabot merged commit 51bc1f5 into chakra-core:release/1.8 Feb 9, 2018
chakrabot pushed a commit that referenced this pull request Feb 9, 2018
…marked as module export storage

Merge pull request #4662 from tcare:classexport

We were mistakenly marking both the class let and const decls as module export storage. This resulted in empty instantiated scopes and incorrect class behavior in some cases.

The fix is not to mark the const binding as module export storage, as it is visible to the inside of the class only.

Added some tests to verify the bindings of exported classes.
chakrabot pushed a commit that referenced this pull request Feb 9, 2018
…correctly marked as module export storage

Merge pull request #4662 from tcare:classexport

We were mistakenly marking both the class let and const decls as module export storage. This resulted in empty instantiated scopes and incorrect class behavior in some cases.

The fix is not to mark the const binding as module export storage, as it is visible to the inside of the class only.

Added some tests to verify the bindings of exported classes.
chakrabot pushed a commit that referenced this pull request Feb 9, 2018
…me binding incorrectly marked as module export storage

Merge pull request #4662 from tcare:classexport

We were mistakenly marking both the class let and const decls as module export storage. This resulted in empty instantiated scopes and incorrect class behavior in some cases.

The fix is not to mark the const binding as module export storage, as it is visible to the inside of the class only.

Added some tests to verify the bindings of exported classes.
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.

5 participants