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:
parent
09a95a692e
commit
c17dc1c057
|
@ -93,7 +93,7 @@ class DiffingTSCompiler implements DiffingBroccoliPlugin {
|
|||
this.tsServiceHost = new CustomLanguageServiceHost(this.tsOpts, this.rootFilePaths,
|
||||
this.fileRegistry, this.inputPath);
|
||||
this.tsService = ts.createLanguageService(this.tsServiceHost, ts.createDocumentRegistry());
|
||||
this.metadataCollector = new MetadataCollector(this.tsService);
|
||||
this.metadataCollector = new MetadataCollector();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ function moduleNameFromBaseName(moduleFileName: string, baseFileName: string): s
|
|||
* Collect decorator metadata from a TypeScript module.
|
||||
*/
|
||||
export class MetadataCollector {
|
||||
constructor(private service: ts.LanguageService) {}
|
||||
constructor() {}
|
||||
|
||||
/**
|
||||
* 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 moduleNameOf = (fileName: string) =>
|
||||
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 {
|
||||
return <MetadataSymbolicExpression>evaluator.evaluateNode(decoratorNode.expression);
|
||||
|
|
|
@ -63,8 +63,8 @@ function isDefined(obj: any): boolean {
|
|||
* possible.
|
||||
*/
|
||||
export class Evaluator {
|
||||
constructor(private service: ts.LanguageService, private typeChecker: ts.TypeChecker,
|
||||
private symbols: Symbols, private moduleNameOf: (fileName: string) => string) {}
|
||||
constructor(private typeChecker: ts.TypeChecker, private symbols: Symbols,
|
||||
private moduleNameOf: (fileName: string) => string) {}
|
||||
|
||||
// TODO: Determine if the first declaration is deterministic.
|
||||
private symbolFileName(symbol: ts.Symbol): string {
|
||||
|
|
|
@ -18,7 +18,7 @@ describe('Collector', () => {
|
|||
service = ts.createLanguageService(host);
|
||||
program = service.getProgram();
|
||||
typeChecker = program.getTypeChecker();
|
||||
collector = new MetadataCollector(service);
|
||||
collector = new MetadataCollector();
|
||||
});
|
||||
|
||||
it('should not have errors in test data', () => { expectValidSources(service, program); });
|
||||
|
|
|
@ -18,7 +18,7 @@ describe('Evaluator', () => {
|
|||
program = service.getProgram();
|
||||
typeChecker = program.getTypeChecker();
|
||||
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', () => {
|
||||
|
|
Loading…
Reference in New Issue