sebastienros / esprima-dotnet

Esprima .NET (BSD license) is a .NET port of the esprima.org project. It is a standard-compliant ECMAScript parser (also popularly known as JavaScript).
BSD 3-Clause "New" or "Revised" License
425 stars 75 forks source link

Fix super access related problems #363

Closed lahma closed 1 year ago

lahma commented 1 year ago
adams85 commented 1 year ago

Sorry for meddling with your work but it was faster to me to make the proposed changes than explain them... 😄

Besides some cleanup, my commit fixes some nasty edge cases like

class X extends Y {
    constructor() {
         var Z = class { get x() { super(); } } // should be rejected
    }
}
class X extends Y {
    constructor() {
        class Z { static { super() } } // should be rejected
    }
}
class X extends Y {
    constructor() {
        class Z extends ZZ { constructor(x = super()) { } } // should be accepted!!!
    }
}
class X extends Y {
    constructor() {
        class Z { x = super() } // should be rejected
    }
}

etc.

Also renamed AllowSuperProperty to AllowSuperAccess (as suggested by #359) because that sounds a bit more expressive to me. Hope you don't mind.

Please take a look at my changes and if you're ok with them, we can consider this done.

lahma commented 1 year ago

Thanks for the review and improvements! Generally on esprima side I feel even more lost than on Jint side.

I'll gladly swallow my pride and take corrections/insights improving my attempt from peers more educated in the subject, so all good!

I'll try to push some fixes later too and appreciate this kind of help!

adams85 commented 1 year ago

I bet you're much more educated in this subject than me... 😄 You and others did the actual heavy-lifting, apart from the JS generator stuff, all I'm doing is just polishing off some rough edges here and there.

I'll try to push some fixes later too and appreciate this kind of help!

Sure thing! Daily job's gonna restart soon, so probably my response time won't be that fast but, of course, I'll gladly help with further refinements as time permits.