Alex Rickabaugh
4dfa71f018
feat(compiler): ability to mark an InvokeFunctionExpr as pure (#26860)
Uglify and other tree-shakers attempt to determine if the invocation of a function is side-effectful, and remove it if so (and the result is unused). A /*@__PURE__*/ annotation on the call site can be used to hint to the optimizer that the invocation has no side effects and is safe to tree-shake away. This commit adds a 'pure' flag to the output AST function call node, which can be used to signal to downstream emitters that a pure annotation should be added. It also modifies ngtsc's emitter to emit an Uglify pure annotation when this flag is set. Testing strategy: this will be tested via its consumers, by asserting that pure functions are translated with the correct comment. PR Close #26860
Angular
Angular is a development platform for building mobile and desktop web applications using Typescript/JavaScript and other languages.
Quickstart
Changelog
Learn about the latest improvements.
Want to help?
Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues in the hotlist: community-help.
Description
Languages
TypeScript
68.6%
HTML
12.8%
JavaScript
8.4%
Pug
7%
Starlark
1.4%
Other
1.7%