Skip to content
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

fix(ivy): identify all ESM5 decorated classes #27848

Conversation

petebacondarwin
Copy link
Member

@petebacondarwin petebacondarwin commented Dec 27, 2018

TODO:

  • Fix up the commit message.

Fixes #27841

@petebacondarwin petebacondarwin added type: bug/fix state: WIP effort1: hours freq2: medium area: core Issues related to the framework runtime target: major This PR is targeted for the next major release comp: ivy risk: low labels Dec 27, 2018
@ngbot ngbot bot added this to the Backlog milestone Dec 27, 2018
@mary-poppins
Copy link

You can preview 1598e41 at https://pr27848-1598e41.ngbuilds.io/.

@mary-poppins
Copy link

You can preview e87a297 at https://pr27848-e87a297.ngbuilds.io/.

@mary-poppins
Copy link

You can preview da9bacf at https://pr27848-da9bacf.ngbuilds.io/.

@petebacondarwin petebacondarwin changed the title fix(ivy): WIP fix(ivy): identify all ESM5 decorated classes Dec 29, 2018
@petebacondarwin petebacondarwin added action: review The PR is still awaiting reviews from at least one requested reviewer and removed state: WIP labels Dec 29, 2018
@mary-poppins
Copy link

You can preview 40f2886 at https://pr27848-40f2886.ngbuilds.io/.

@alan-agius4
Copy link
Contributor

Can confirm that this fixes both #27841 and #27794

@@ -662,8 +662,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
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
Member 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.

In ESM5 decorated classes can be indicated by calls to `__decorate()`.
Previously the `ReflectionHost.findDecoratedClasses()` call would identify
helper calls of the form:

```
SomeClass = tslib_1.__decorate(...);
```

But it was missing calls of the form:

```
SomeClass = SomeClass_1 = tslib_1.__decorate(...);
```

This form is common in `@NgModule()` decorations, where the class
being decorated is referenced inside the decorator or another
member.

This commit now ensures that a chain of assignments, of any length,
is now identified as a class decoration if it results in a call to
`__decorate()`.

Fixes angular#27841
@mary-poppins
Copy link

You can preview d09190a at https://pr27848-d09190a.ngbuilds.io/.

@petebacondarwin petebacondarwin added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jan 11, 2019
@petebacondarwin petebacondarwin deleted the ngcc-find-esm5-decorated-classes branch January 11, 2019 20:38
kyliau pushed a commit to kyliau/angular that referenced this pull request Jan 11, 2019
In ESM5 decorated classes can be indicated by calls to `__decorate()`.
Previously the `ReflectionHost.findDecoratedClasses()` call would identify
helper calls of the form:

```
SomeClass = tslib_1.__decorate(...);
```

But it was missing calls of the form:

```
SomeClass = SomeClass_1 = tslib_1.__decorate(...);
```

This form is common in `@NgModule()` decorations, where the class
being decorated is referenced inside the decorator or another
member.

This commit now ensures that a chain of assignments, of any length,
is now identified as a class decoration if it results in a call to
`__decorate()`.

Fixes angular#27841

PR Close angular#27848
petebacondarwin added a commit to petebacondarwin/angular that referenced this pull request Jan 14, 2019
In ESM5 decorated classes can be indicated by calls to `__decorate()`.
Previously the `ReflectionHost.findDecoratedClasses()` call would identify
helper calls of the form:

```
SomeClass = tslib_1.__decorate(...);
```

But it was missing calls of the form:

```
SomeClass = SomeClass_1 = tslib_1.__decorate(...);
```

This form is common in `@NgModule()` decorations, where the class
being decorated is referenced inside the decorator or another
member.

This commit now ensures that a chain of assignments, of any length,
is now identified as a class decoration if it results in a call to
`__decorate()`.

Fixes angular#27841

PR Close angular#27848
wKoza pushed a commit to wKoza/angular that referenced this pull request Jan 18, 2019
In ESM5 decorated classes can be indicated by calls to `__decorate()`.
Previously the `ReflectionHost.findDecoratedClasses()` call would identify
helper calls of the form:

```
SomeClass = tslib_1.__decorate(...);
```

But it was missing calls of the form:

```
SomeClass = SomeClass_1 = tslib_1.__decorate(...);
```

This form is common in `@NgModule()` decorations, where the class
being decorated is referenced inside the decorator or another
member.

This commit now ensures that a chain of assignments, of any length,
is now identified as a class decoration if it results in a call to
`__decorate()`.

Fixes angular#27841

PR Close angular#27848
wKoza pushed a commit to wKoza/angular that referenced this pull request Jan 18, 2019
In ESM5 decorated classes can be indicated by calls to `__decorate()`.
Previously the `ReflectionHost.findDecoratedClasses()` call would identify
helper calls of the form:

```
SomeClass = tslib_1.__decorate(...);
```

But it was missing calls of the form:

```
SomeClass = SomeClass_1 = tslib_1.__decorate(...);
```

This form is common in `@NgModule()` decorations, where the class
being decorated is referenced inside the decorator or another
member.

This commit now ensures that a chain of assignments, of any length,
is now identified as a class decoration if it results in a call to
`__decorate()`.

Fixes angular#27841

PR Close angular#27848
ngfelixl pushed a commit to ngfelixl/angular that referenced this pull request Jan 28, 2019
In ESM5 decorated classes can be indicated by calls to `__decorate()`.
Previously the `ReflectionHost.findDecoratedClasses()` call would identify
helper calls of the form:

```
SomeClass = tslib_1.__decorate(...);
```

But it was missing calls of the form:

```
SomeClass = SomeClass_1 = tslib_1.__decorate(...);
```

This form is common in `@NgModule()` decorations, where the class
being decorated is referenced inside the decorator or another
member.

This commit now ensures that a chain of assignments, of any length,
is now identified as a class decoration if it results in a call to
`__decorate()`.

Fixes angular#27841

PR Close angular#27848
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime cla: yes effort1: hours freq2: medium risk: low target: major This PR is targeted for the next major release type: bug/fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ngcc not running on all files (ESM5)
6 participants