Which @angular/* package(s) are the source of the bug?
compiler
Is this a regression?
No
Description
Consider text interpolate in a template: {{ {name: 'Angular'} | json }}. Since we are declaring an object in a template, the generated code would be along the lines of: textInterpolate1(" ", pipeBind1(1, 1, pureFunction0(3, _c0)), " "); (where _c0 = ()=>({ name: "Angular" });.
Notice that we generate an arrow function wrapper around _c0 and the pureFunction call - even if {name: 'Angular'} is an object literal that will never change. We could optimize for such case and skip the pureFunction0 instruction call (alongside with the arrow function for _c0).
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/stackblitz-starters-tej7hv?description=An%20angular-cli%20project%20based%20on%20@angular/animations,%20@angular/common,%20@angular/compiler,%20@angular/core,%20@angular/forms,%20@angular/platform-browser,%20@angular/platform-browser-dynamic,%20@angular/router,%20core-js,%20rxjs,%20tslib%20and%20zone.js&file=src%2Fmain.ts&template=node&title=Angular%20Starter
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run ng version)
No response
Anything else?
Not the most common scenario / major optimization but still nice to have!
Which @angular/* package(s) are the source of the bug?
compiler
Is this a regression?
No
Description
Consider text interpolate in a template:
{{ {name: 'Angular'} | json }}. Since we are declaring an object in a template, the generated code would be along the lines of:textInterpolate1(" ", pipeBind1(1, 1, pureFunction0(3, _c0)), " ");(where_c0 = ()=>({ name: "Angular" });.Notice that we generate an arrow function wrapper around
_c0and thepureFunctioncall - even if{name: 'Angular'}is an object literal that will never change. We could optimize for such case and skip thepureFunction0instruction call (alongside with the arrow function for _c0).Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/stackblitz-starters-tej7hv?description=An%20angular-cli%20project%20based%20on%20@angular/animations,%20@angular/common,%20@angular/compiler,%20@angular/core,%20@angular/forms,%20@angular/platform-browser,%20@angular/platform-browser-dynamic,%20@angular/router,%20core-js,%20rxjs,%20tslib%20and%20zone.js&file=src%2Fmain.ts&template=node&title=Angular%20Starter
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run
ng version)No response
Anything else?
Not the most common scenario / major optimization but still nice to have!