feat(ivy): ngtsc support for static resolution of array.slice()#27158
feat(ivy): ngtsc support for static resolution of array.slice()#27158JoostK wants to merge 1 commit intoangular:masterfrom
Conversation
For ngcc's processing of ES5 bundles, the spread syntax has been downleveled from `[...ARRAY]` to become `ARRAY.slice()`. This commit adds basic support for static resolution of such call.
petebacondarwin
left a comment
There was a problem hiding this comment.
Another nice catch!
| () => { expect(evaluate(`const a = [1, 2, 3];`, 'a[\'length\'] + 1')).toEqual(4); }); | ||
|
|
||
| it('array `slice` function works', () => { | ||
| expect(evaluate(`const a = [1, 2, 3];`, 'a[\'slice\']()')).toEqual([1, 2, 3]); |
There was a problem hiding this comment.
Why does the test use a['slice'] instead of a.slice?
There was a problem hiding this comment.
Copied from above. I can change it as it isn't really relevant here.
petebacondarwin
left a comment
There was a problem hiding this comment.
Actually I take that back - this version fails CI: https://travis-ci.org/angular/angular/jobs/457091732#L1288
02f0151 to
ad91a3d
Compare
|
@petebacondarwin Ah, interesting. I removed the fixup commit to revert to the original code. |
|
@petebacondarwin could you approve again? I dropped the faulty commit that broke stuff, everything is green again :) |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
For ngcc's processing of ES5 bundles, the spread syntax has been
downleveled from
[...ARRAY]to becomeARRAY.slice(). This commitadds basic support for static resolution of such call.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
ngtsc is unable to process ES5 bundles in which the spread operator is downleveled into an
Array.prototype.slicecall.What is the new behavior?
Support for static resolution of such calls.
Does this PR introduce a breaking change?
Other information