-
Notifications
You must be signed in to change notification settings - Fork 12k
Update ivy set calls #16228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update ivy set calls #16228
Conversation
This PR is blocked by angular/angular#33671 and angular/angular#33337 being merged and released. Afterwards, this PR should be updated to use the new FW version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
per our discussion on angular/angular#33337 this change LGTM
@@ -304,7 +303,35 @@ function isAssignmentExpressionTo(exprStmt: ts.ExpressionStatement, name: string | |||
} | |||
|
|||
function isIvyPrivateCallExpression(exprStmt: ts.ExpressionStatement) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: The IIFE structure could technically be different depending on any intermediate processing steps. The CLI's fixed configuration will prevent this but other usage may cause changes. An unbounded number of parenthesized expressions are also technically possible.
Examples: !function(){}()
or (function(){}())
or ((function(){})())
This commit transforms the setClassMetadata calls generated by ngtsc from: ```typescript /*@__PURE__*/ setClassMetadata(...); ``` to: ```typescript /*@__PURE__*/ (function() { setClassMetadata(...); })(); ``` Without the IIFE, terser won't remove these function calls because the function calls have arguments that themselves are function calls or other impure expressions. In order to make the whole block be DCE-ed by terser, we wrap it into IIFE and mark the IIFE as pure. It should be noted that this change doesn't have any impact on CLI* with build-optimizer, which removes the whole setClassMetadata block within the webpack loader, so terser or webpack itself don't get to see it at all. This is done to prevent cross-chunk retention issues caused by webpack's internal module registry. * actually we do expect a short-term size regression while angular/angular-cli#16228 is merged and released in the next rc of the CLI. But long term this change does nothing to CLI + build-optimizer configuration and is done primarly to correct the seemingly correct but non-function PURE annotation that builds not using build-optimizer could rely on.
This commit transforms the setClassMetadata calls generated by ngtsc from: ```typescript /*@__PURE__*/ setClassMetadata(...); ``` to: ```typescript /*@__PURE__*/ (function() { setClassMetadata(...); })(); ``` Without the IIFE, terser won't remove these function calls because the function calls have arguments that themselves are function calls or other impure expressions. In order to make the whole block be DCE-ed by terser, we wrap it into IIFE and mark the IIFE as pure. It should be noted that this change doesn't have any impact on CLI* with build-optimizer, which removes the whole setClassMetadata block within the webpack loader, so terser or webpack itself don't get to see it at all. This is done to prevent cross-chunk retention issues caused by webpack's internal module registry. * actually we do expect a short-term size regression while angular/angular-cli#16228 is merged and released in the next rc of the CLI. But long term this change does nothing to CLI + build-optimizer configuration and is done primarly to correct the seemingly correct but non-function PURE annotation that builds not using build-optimizer could rely on. PR Close #33337
This commit transforms the setClassMetadata calls generated by ngtsc from: ```typescript /*@__PURE__*/ setClassMetadata(...); ``` to: ```typescript /*@__PURE__*/ (function() { setClassMetadata(...); })(); ``` Without the IIFE, terser won't remove these function calls because the function calls have arguments that themselves are function calls or other impure expressions. In order to make the whole block be DCE-ed by terser, we wrap it into IIFE and mark the IIFE as pure. It should be noted that this change doesn't have any impact on CLI* with build-optimizer, which removes the whole setClassMetadata block within the webpack loader, so terser or webpack itself don't get to see it at all. This is done to prevent cross-chunk retention issues caused by webpack's internal module registry. * actually we do expect a short-term size regression while angular/angular-cli#16228 is merged and released in the next rc of the CLI. But long term this change does nothing to CLI + build-optimizer configuration and is done primarly to correct the seemingly correct but non-function PURE annotation that builds not using build-optimizer could rely on. PR Close #33337
… calls These will be automatically removed after angular/angular#33671 lands because they are in a side-effect free IIFE.
…ormat It's in a IIFE after angular/angular#33337 lands.
40fb01a
to
65fff2a
Compare
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. |
No description provided.