fix(7837): MetadataCollector takes no parameters for the constructor.

MetadataCollector no longer requires a ts.LanguageService parameter
it didn't use.

Closes #7838
This commit is contained in:
Chuck Jazdzewski 2016-03-30 15:00:55 -07:00
parent 09a95a692e
commit c17dc1c057
5 changed files with 7 additions and 7 deletions

View File

@ -93,7 +93,7 @@ class DiffingTSCompiler implements DiffingBroccoliPlugin {
this.tsServiceHost = new CustomLanguageServiceHost(this.tsOpts, this.rootFilePaths, this.tsServiceHost = new CustomLanguageServiceHost(this.tsOpts, this.rootFilePaths,
this.fileRegistry, this.inputPath); this.fileRegistry, this.inputPath);
this.tsService = ts.createLanguageService(this.tsServiceHost, ts.createDocumentRegistry()); this.tsService = ts.createLanguageService(this.tsServiceHost, ts.createDocumentRegistry());
this.metadataCollector = new MetadataCollector(this.tsService); this.metadataCollector = new MetadataCollector();
} }

View File

@ -48,7 +48,7 @@ function moduleNameFromBaseName(moduleFileName: string, baseFileName: string): s
* Collect decorator metadata from a TypeScript module. * Collect decorator metadata from a TypeScript module.
*/ */
export class MetadataCollector { export class MetadataCollector {
constructor(private service: ts.LanguageService) {} constructor() {}
/** /**
* Returns a JSON.stringify friendly form describing the decorators of the exported classes from * Returns a JSON.stringify friendly form describing the decorators of the exported classes from
@ -58,7 +58,7 @@ export class MetadataCollector {
const locals = new Symbols(); const locals = new Symbols();
const moduleNameOf = (fileName: string) => const moduleNameOf = (fileName: string) =>
moduleNameFromBaseName(fileName, sourceFile.fileName); moduleNameFromBaseName(fileName, sourceFile.fileName);
const evaluator = new Evaluator(this.service, typeChecker, locals, moduleNameOf); const evaluator = new Evaluator(typeChecker, locals, moduleNameOf);
function objFromDecorator(decoratorNode: ts.Decorator): MetadataSymbolicExpression { function objFromDecorator(decoratorNode: ts.Decorator): MetadataSymbolicExpression {
return <MetadataSymbolicExpression>evaluator.evaluateNode(decoratorNode.expression); return <MetadataSymbolicExpression>evaluator.evaluateNode(decoratorNode.expression);

View File

@ -63,8 +63,8 @@ function isDefined(obj: any): boolean {
* possible. * possible.
*/ */
export class Evaluator { export class Evaluator {
constructor(private service: ts.LanguageService, private typeChecker: ts.TypeChecker, constructor(private typeChecker: ts.TypeChecker, private symbols: Symbols,
private symbols: Symbols, private moduleNameOf: (fileName: string) => string) {} private moduleNameOf: (fileName: string) => string) {}
// TODO: Determine if the first declaration is deterministic. // TODO: Determine if the first declaration is deterministic.
private symbolFileName(symbol: ts.Symbol): string { private symbolFileName(symbol: ts.Symbol): string {

View File

@ -18,7 +18,7 @@ describe('Collector', () => {
service = ts.createLanguageService(host); service = ts.createLanguageService(host);
program = service.getProgram(); program = service.getProgram();
typeChecker = program.getTypeChecker(); typeChecker = program.getTypeChecker();
collector = new MetadataCollector(service); collector = new MetadataCollector();
}); });
it('should not have errors in test data', () => { expectValidSources(service, program); }); it('should not have errors in test data', () => { expectValidSources(service, program); });

View File

@ -18,7 +18,7 @@ describe('Evaluator', () => {
program = service.getProgram(); program = service.getProgram();
typeChecker = program.getTypeChecker(); typeChecker = program.getTypeChecker();
symbols = new Symbols(); symbols = new Symbols();
evaluator = new Evaluator(service, typeChecker, symbols, f => f); evaluator = new Evaluator(typeChecker, symbols, f => f);
}); });
it('should not have typescript errors in test data', () => { it('should not have typescript errors in test data', () => {