Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration/_payload-limits.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"master": {
"uncompressed": {
"runtime": 1440,
"main": 507677,
"main": 584077,
"polyfills": 38390
}
}
Expand Down
22 changes: 11 additions & 11 deletions integration/ngcc/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


"@angular/animations@file:../../dist/packages-dist/animations":
version "7.1.0"
version "7.2.0-rc.0"
dependencies:
tslib "^1.9.0"

Expand All @@ -17,12 +17,12 @@
parse5 "^5.0.0"

"@angular/common@file:../../dist/packages-dist/common":
version "7.1.0"
version "0.0.0"
dependencies:
tslib "^1.9.0"

"@angular/compiler-cli@file:../../dist/packages-dist/compiler-cli":
version "7.1.0"
version "0.0.0"
dependencies:
canonical-path "1.0.0"
chokidar "^1.4.2"
Expand All @@ -37,22 +37,22 @@
yargs "9.0.1"

"@angular/compiler@file:../../dist/packages-dist/compiler":
version "7.1.0"
version "7.2.0-rc.0"
dependencies:
tslib "^1.9.0"

"@angular/core@file:../../dist/packages-dist/core":
version "7.1.0"
version "0.0.0"
dependencies:
tslib "^1.9.0"

"@angular/forms@file:../../dist/packages-dist/forms":
version "7.1.0"
version "0.0.0"
dependencies:
tslib "^1.9.0"

"@angular/http@file:../../dist/packages-dist/http":
version "7.1.0"
version "7.2.0-rc.0"
dependencies:
tslib "^1.9.0"

Expand All @@ -66,17 +66,17 @@
parse5 "^5.0.0"

"@angular/platform-browser-dynamic@file:../../dist/packages-dist/platform-browser-dynamic":
version "7.1.0"
version "7.2.0-rc.0"
dependencies:
tslib "^1.9.0"

"@angular/platform-browser@file:../../dist/packages-dist/platform-browser":
version "7.1.0"
version "0.0.0"
dependencies:
tslib "^1.9.0"

"@angular/router@file:../../dist/packages-dist/router":
version "7.1.0"
version "0.0.0"
dependencies:
tslib "^1.9.0"

Expand Down Expand Up @@ -3278,7 +3278,7 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0:
integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=

"typescript@file:../../node_modules/typescript":
version "3.1.1"
version "3.2.2"

ua-parser-js@0.7.17:
version "0.7.17"
Expand Down
6 changes: 4 additions & 2 deletions packages/compiler-cli/src/ngcc/src/host/esm2015_host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,10 @@ export class Esm2015ReflectionHost extends TypeScriptReflectionHost implements N
*/
protected getHelperCall(statement: ts.Statement, helperName: string): ts.CallExpression|null {
if (ts.isExpressionStatement(statement)) {
const expression =
isAssignmentStatement(statement) ? statement.expression.right : statement.expression;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isAssignmentStatement has now gone unused it seems.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used in Esm5ReflectionHost.

let expression = statement.expression;
while (isAssignment(expression)) {
expression = expression.right;
}
if (ts.isCallExpression(expression) && getCalleeName(expression) === helperName) {
return expression;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,27 @@ describe('Esm5ReflectionHost [import helper style]', () => {
});
});

describe('findDecoratedClasses', () => {
it('should return an array of all decorated classes in the given source file', () => {
const program = makeTestProgram(...fileSystem.files);
const host = new Esm5ReflectionHost(false, program.getTypeChecker());

const ngModuleFile = program.getSourceFile('/ngmodule.js') !;
const ngModuleClasses = host.findDecoratedClasses(ngModuleFile);
expect(ngModuleClasses.length).toEqual(1);
const ngModuleClass = ngModuleClasses.find(c => c.name === 'HttpClientXsrfModule') !;
expect(ngModuleClass.decorators.map(decorator => decorator.name)).toEqual(['NgModule']);

const someDirectiveFile = program.getSourceFile('/some_directive.js') !;
const someDirectiveClasses = host.findDecoratedClasses(someDirectiveFile);
expect(someDirectiveClasses.length).toEqual(1);
const someDirectiveClass = someDirectiveClasses.find(c => c.name === 'SomeDirective') !;
expect(someDirectiveClass.decorators.map(decorator => decorator.name)).toEqual([
'Directive'
]);
});
});

describe('getDeclarationOfIdentifier', () => {
it('should return the declaration of a locally defined identifier', () => {
const program = makeTestProgram(fileSystem.files[0]);
Expand Down