Handle super.__proto__
, which has a special implementation
#1737
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR, co-authored with @0xe, adds support for the crazy
super.__proto__
. It is stacked on top of #1735.In Rhino there is a special implementation that uses
Ref
andGET_REF
(and similar) for things likea.__proto__
,a.__parent__
and xml access. We have extended this tosuper
.A really surprising thing that we discovered looking at other engines is that the semantics of
super.__proto__
is a bit confusing - it ends up beingthis.__proto__
basically, because__proto__
is resolved onsuper
but then accessed onthis
. So, the implementation uses a horrible hack: it replacessuper.__proto__
withthis.__proto__
in the IR. This seems to work, according to the tests that we have added, and while a bit dirty, it seems fine to us for such a strange edge case.