fix(compiler): correctly handle when `toString` is exported (#15430)

Fixes #15420
This commit is contained in:
Chuck Jazdzewski 2017-03-23 13:38:01 -07:00 committed by Victor Berchet
parent c8ab5cb0c5
commit 0dda01e37c
2 changed files with 8 additions and 1 deletions

View File

@ -224,7 +224,7 @@ export class StaticSymbolResolver {
this.recordImportAs(symbol, importSymbol); this.recordImportAs(symbol, importSymbol);
} }
const origin = origins[metadataKey]; const origin = origins.hasOwnProperty(metadataKey) && origins[metadataKey];
if (origin) { if (origin) {
// If the symbol is from a bundled index, use the declaration location of the // If the symbol is from a bundled index, use the declaration location of the
// symbol so relative references (such as './my.html') will be calculated // symbol so relative references (such as './my.html') will be calculated

View File

@ -577,6 +577,7 @@ const FILES: MockData = {
`, `,
'app.module.ts': ` 'app.module.ts': `
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { toString } from './utils';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
@ -585,6 +586,12 @@ const FILES: MockData = {
bootstrap: [ AppComponent ] bootstrap: [ AppComponent ]
}) })
export class AppModule { } export class AppModule { }
`,
// #15420
'utils.ts': `
export function toString(value: any): string {
return '';
}
` `
} }
} }