feat(core): missing-injectable migration should migrate empty object literal providers (#33709)

In View Engine, providers which neither used `useValue`, `useClass`,
`useFactory` or `useExisting`, were interpreted differently.

e.g.

```
{provide: X} -> {provide: X, useValue: undefined}, // this is how it works in View Engine
{provide: X} -> {provide: X, useClass: X}, // this is how it works in Ivy
```

The missing-injectable migration should migrate such providers to the
explicit `useValue` provider. This ensures that there is no unexpected
behavioral change when updating to v9.

PR Close #33709
This commit is contained in:
Paul Gschwendtner
2019-11-14 10:16:07 +01:00
committed by Alex Rickabaugh
parent 71b8e271b3
commit 15fefdbb8d
10 changed files with 229 additions and 48 deletions

View File

@ -160,7 +160,7 @@ export class StaticInterpreter {
return array;
}
private visitObjectLiteralExpression(node: ts.ObjectLiteralExpression, context: Context):
protected visitObjectLiteralExpression(node: ts.ObjectLiteralExpression, context: Context):
ResolvedValue {
const map: ResolvedValueMap = new Map<string, ResolvedValue>();
for (let i = 0; i < node.properties.length; i++) {