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:

committed by
Chuck Jazdzewski

parent
de8d7c65f2
commit
50abca4583
@ -21,6 +21,6 @@ export interface PlatformReflectionCapabilities {
|
||||
method(name: string): MethodFn;
|
||||
importUri(type: Type<any>): string;
|
||||
resourceUri(type: Type<any>): string;
|
||||
resolveIdentifier(name: string, moduleUrl: string, members: string[]|null, runtime: any): any;
|
||||
resolveIdentifier(name: string, moduleUrl: string, members: string[], runtime: any): any;
|
||||
resolveEnum(enumIdentifier: any, name: string): any;
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
import {Type} from '../type';
|
||||
import {PlatformReflectionCapabilities} from './platform_reflection_capabilities';
|
||||
import {ReflectorReader} from './reflector_reader';
|
||||
import {GetterFn, MethodFn, SetterFn} from './types';
|
||||
|
||||
export {PlatformReflectionCapabilities} from './platform_reflection_capabilities';
|
||||
@ -18,8 +17,8 @@ export {GetterFn, MethodFn, SetterFn} from './types';
|
||||
* Provides access to reflection data about symbols. Used internally by Angular
|
||||
* to power dependency injection and compilation.
|
||||
*/
|
||||
export class Reflector extends ReflectorReader {
|
||||
constructor(public reflectionCapabilities: PlatformReflectionCapabilities) { super(); }
|
||||
export class Reflector {
|
||||
constructor(public reflectionCapabilities: PlatformReflectionCapabilities) {}
|
||||
|
||||
updateCapabilities(caps: PlatformReflectionCapabilities) { this.reflectionCapabilities = caps; }
|
||||
|
||||
@ -51,7 +50,7 @@ export class Reflector extends ReflectorReader {
|
||||
|
||||
resourceUri(type: any): string { return this.reflectionCapabilities.resourceUri(type); }
|
||||
|
||||
resolveIdentifier(name: string, moduleUrl: string, members: string[]|null, runtime: any): any {
|
||||
resolveIdentifier(name: string, moduleUrl: string, members: string[], runtime: any): any {
|
||||
return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime);
|
||||
}
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides read-only access to reflection data about symbols. Used internally by Angular
|
||||
* to power dependency injection and compilation.
|
||||
*/
|
||||
export abstract class ReflectorReader {
|
||||
abstract parameters(typeOrFunc: /*Type*/ any): any[][];
|
||||
abstract annotations(typeOrFunc: /*Type*/ any): any[];
|
||||
abstract propMetadata(typeOrFunc: /*Type*/ any): {[key: string]: any[]};
|
||||
abstract importUri(typeOrFunc: /*Type*/ any): string|null;
|
||||
abstract resourceUri(typeOrFunc: /*Type*/ any): string;
|
||||
abstract resolveIdentifier(name: string, moduleUrl: string, members: string[], runtime: any): any;
|
||||
abstract resolveEnum(identifier: any, name: string): any;
|
||||
}
|
Reference in New Issue
Block a user