refactor(compiler): replace isStaticSymbol with instanceof StaticSymbol

This commit is contained in:
Tobias Bosch
2016-12-05 13:26:12 -08:00
committed by Alex Rickabaugh
parent c767df0e4e
commit c3065aac7a
5 changed files with 9 additions and 13 deletions

View File

@ -6,10 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
export function isStaticSymbol(value: any): value is StaticSymbol {
return typeof value === 'object' && value !== null && value['name'] && value['filePath'];
}
/**
* A token representing the a reference to a static type.
*

View File

@ -10,7 +10,7 @@ import {SummaryResolver} from '../summary_resolver';
import {GeneratedFile} from './generated_file';
import {StaticReflector} from './static_reflector';
import {StaticSymbol, isStaticSymbol} from './static_symbol';
import {StaticSymbol} from './static_symbol';
import {filterFileByPatterns} from './utils';
const STRIP_SRC_FILE_SUFFIXES = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/;
@ -43,7 +43,7 @@ export class AotSummaryResolver implements SummaryResolver {
serializeSummaries(srcFileUrl: string, summaries: CompileTypeSummary[]): GeneratedFile {
const jsonReplacer = (key: string, value: any) => {
if (key === 'reference' && isStaticSymbol(value)) {
if (key === 'reference' && value instanceof StaticSymbol) {
// We convert the source filenames into output filenames,
// as the generated summary file will be used when the current
// compilation unit is used as a library