Skip to content

Commit 2b4d5c7

Browse files
devversionIgorMinar
authored andcommitted
fix(ivy): ngcc should process undecorated base classes (angular#30821)
Currently undecorated classes are intentionally not processed with ngcc. This is causing unexpected behavior because decorator handlers such as `base_def.ts` are specifically interested in class definitions without top-level decorators, so that the base definition can be generated if there are Angular-specific class members. In order to ensure that undecorated base-classes work as expected with Ivy, we need to run the decorator handlers for all top-level class declarations (not only for those with decorators). This is similar to when `ngtsc` runs decorator handlers when analyzing source-files. Resolves FW-1355. Fixes angular/components#16178 PR Close angular#30821
1 parent 271d2b5 commit 2b4d5c7

20 files changed

+526
-373
lines changed

integration/ngcc/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"license": "MIT",
55
"dependencies": {
66
"@angular/animations": "file:../../dist/packages-dist/animations",
7-
"@angular/cdk": "^7.0.0-rc.1",
7+
"@angular/cdk": "^8.0.0",
88
"@angular/common": "file:../../dist/packages-dist/common",
99
"@angular/compiler": "file:../../dist/packages-dist/compiler",
1010
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
1111
"@angular/core": "file:../../dist/packages-dist/core",
1212
"@angular/forms": "file:../../dist/packages-dist/forms",
13-
"@angular/material": "7.0.0-rc.1",
13+
"@angular/material": "8.0.0",
1414
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
1515
"@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic",
1616
"@angular/router": "file:../../dist/packages-dist/router",

integration/ngcc/test.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ if [[ $? != 0 ]]; then exit 1; fi
6161
grep "const ɵMatTable_BaseFactory = ɵngcc0.ɵɵgetInheritedFactory(MatTable);" node_modules/@angular/material/esm5/table.es5.js
6262
if [[ $? != 0 ]]; then exit 1; fi
6363

64+
# Did it generate a base definition for undecorated classes with inputs and view queries?
65+
grep "_MatMenuBase.ngBaseDef = ɵngcc0.ɵɵdefineBase({ inputs: {" node_modules/@angular/material/esm2015/menu.js
66+
if [[ $? != 0 ]]; then exit 1; fi
67+
grep "_MatMenuBase.ngBaseDef = ɵngcc0.ɵɵdefineBase({ inputs: {" node_modules/@angular/material/esm5/menu.es5.js
68+
if [[ $? != 0 ]]; then exit 1; fi
69+
6470
# Can it be safely run again (as a noop)?
6571
# And check that it logged skipping compilation as expected
6672
ivy-ngcc -l debug | grep 'Skipping'

0 commit comments

Comments
 (0)