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
@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
import {DatePipe} from '@angular/common';
|
||||
import {JitReflector} from '@angular/compiler';
|
||||
import {PipeResolver} from '@angular/compiler/src/pipe_resolver';
|
||||
import {browserDetection} from '@angular/platform-browser/testing/src/browser_util';
|
||||
|
||||
@ -34,8 +35,9 @@ export function main() {
|
||||
pipe = new DatePipe('en-US');
|
||||
});
|
||||
|
||||
it('should be marked as pure',
|
||||
() => { expect(new PipeResolver().resolve(DatePipe) !.pure).toEqual(true); });
|
||||
it('should be marked as pure', () => {
|
||||
expect(new PipeResolver(new JitReflector()).resolve(DatePipe) !.pure).toEqual(true);
|
||||
});
|
||||
|
||||
describe('supports', () => {
|
||||
it('should support date', () => { expect(() => pipe.transform(date)).not.toThrow(); });
|
||||
|
@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
import {I18nPluralPipe, NgLocalization} from '@angular/common';
|
||||
import {JitReflector} from '@angular/compiler';
|
||||
import {PipeResolver} from '@angular/compiler/src/pipe_resolver';
|
||||
import {beforeEach, describe, expect, it} from '@angular/core/testing/src/testing_internal';
|
||||
|
||||
@ -27,8 +28,9 @@ export function main() {
|
||||
pipe = new I18nPluralPipe(localization);
|
||||
});
|
||||
|
||||
it('should be marked as pure',
|
||||
() => { expect(new PipeResolver().resolve(I18nPluralPipe) !.pure).toEqual(true); });
|
||||
it('should be marked as pure', () => {
|
||||
expect(new PipeResolver(new JitReflector()).resolve(I18nPluralPipe) !.pure).toEqual(true);
|
||||
});
|
||||
|
||||
describe('transform', () => {
|
||||
it('should return 0 text if value is 0', () => {
|
||||
|
@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
import {I18nSelectPipe} from '@angular/common';
|
||||
import {JitReflector} from '@angular/compiler';
|
||||
import {PipeResolver} from '@angular/compiler/src/pipe_resolver';
|
||||
|
||||
export function main() {
|
||||
@ -14,8 +15,9 @@ export function main() {
|
||||
const pipe: I18nSelectPipe = new I18nSelectPipe();
|
||||
const mapping = {'male': 'Invite him.', 'female': 'Invite her.', 'other': 'Invite them.'};
|
||||
|
||||
it('should be marked as pure',
|
||||
() => { expect(new PipeResolver().resolve(I18nSelectPipe) !.pure).toEqual(true); });
|
||||
it('should be marked as pure', () => {
|
||||
expect(new PipeResolver(new JitReflector()).resolve(I18nSelectPipe) !.pure).toEqual(true);
|
||||
});
|
||||
|
||||
describe('transform', () => {
|
||||
it('should return the "male" text if value is "male"', () => {
|
||||
|
Reference in New Issue
Block a user