refactor(compiler): don’t rely on global reflector (#16832)

Using the global reflector made it impossible
to compile multiple programs at the same time.
This commit is contained in:
Tobias Bosch
2017-05-18 13:46:51 -07:00
committed by Chuck Jazdzewski
parent de8d7c65f2
commit 50abca4583
52 changed files with 333 additions and 338 deletions

View File

@ -5,7 +5,7 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {DirectiveResolver} from '@angular/compiler';
import {CompileReflector, DirectiveResolver} from '@angular/compiler';
import {Compiler, Component, Directive, Injectable, Injector, Provider, Type, resolveForwardRef, ɵViewMetadata as ViewMetadata} from '@angular/core';
@ -22,7 +22,7 @@ export class MockDirectiveResolver extends DirectiveResolver {
private _views = new Map<Type<any>, ViewMetadata>();
private _inlineTemplates = new Map<Type<any>, string>();
constructor(private _injector: Injector) { super(); }
constructor(private _injector: Injector, reflector: CompileReflector) { super(reflector); }
private get _compiler(): Compiler { return this._injector.get(Compiler); }

View File

@ -6,14 +6,14 @@
* found in the LICENSE file at https://angular.io/license
*/
import {NgModuleResolver} from '@angular/compiler';
import {CompileReflector, NgModuleResolver} from '@angular/compiler';
import {Compiler, Injectable, Injector, NgModule, Type} from '@angular/core';
@Injectable()
export class MockNgModuleResolver extends NgModuleResolver {
private _ngModules = new Map<Type<any>, NgModule>();
constructor(private _injector: Injector) { super(); }
constructor(private _injector: Injector, reflector: CompileReflector) { super(reflector); }
/**
* Overrides the {@link NgModule} for a module.

View File

@ -6,14 +6,14 @@
* found in the LICENSE file at https://angular.io/license
*/
import {PipeResolver} from '@angular/compiler';
import {CompileReflector, PipeResolver} from '@angular/compiler';
import {Compiler, Injectable, Injector, Pipe, Type} from '@angular/core';
@Injectable()
export class MockPipeResolver extends PipeResolver {
private _pipes = new Map<Type<any>, Pipe>();
constructor(private _injector: Injector) { super(); }
constructor(private _injector: Injector, refector: CompileReflector) { super(refector); }
private get _compiler(): Compiler { return this._injector.get(Compiler); }