feat(compiler): Added support for limited function calls in metadata. (#9125)

The collector now collects the body of functions that return an
expression as a symbolic 'function'. The static reflector supports
expanding these functions statically to allow provider macros.

Also added support for the array spread operator in both the
collector and the static reflector.
This commit is contained in:
Chuck Jazdzewski
2016-06-13 15:56:51 -07:00
committed by GitHub
parent 5c0cfdee48
commit 5504ca1e38
10 changed files with 642 additions and 142 deletions

View File

@ -1,6 +1,8 @@
import * as common from '@angular/common';
import {Component, Inject, OpaqueToken} from '@angular/core';
import {wrapInArray} from './funcs';
export const SOME_OPAQUE_TOKEN = new OpaqueToken('opaqueToken');
@Component({
@ -23,7 +25,7 @@ export class CompWithProviders {
<input #a>{{a.value}}
<div *ngIf="true">{{a.value}}</div>
`,
directives: [common.NgIf]
directives: [wrapInArray(common.NgIf)]
})
export class CompWithReferences {
}

View File

@ -0,0 +1,3 @@
export function wrapInArray(value: any): any[] {
return [value];
}