fix(compiler): report better error messages for host
bindings
Closes #10346
This commit is contained in:
@ -22,7 +22,8 @@ export class ParseSourceFile {
|
||||
}
|
||||
|
||||
export class ParseSourceSpan {
|
||||
constructor(public start: ParseLocation, public end: ParseLocation) {}
|
||||
constructor(
|
||||
public start: ParseLocation, public end: ParseLocation, public details: string = null) {}
|
||||
|
||||
toString(): string {
|
||||
return this.start.file.content.substring(this.start.offset, this.end.offset);
|
||||
@ -43,6 +44,7 @@ export abstract class ParseError {
|
||||
var source = this.span.start.file.content;
|
||||
var ctxStart = this.span.start.offset;
|
||||
var contextStr = '';
|
||||
var details = '';
|
||||
if (isPresent(ctxStart)) {
|
||||
if (ctxStart > source.length - 1) {
|
||||
ctxStart = source.length - 1;
|
||||
@ -77,6 +79,9 @@ export abstract class ParseError {
|
||||
source.substring(this.span.start.offset, ctxEnd + 1);
|
||||
contextStr = ` ("${context}")`;
|
||||
}
|
||||
return `${this.msg}${contextStr}: ${this.span.start}`;
|
||||
if (this.span.details) {
|
||||
details = `, ${this.span.details}`;
|
||||
}
|
||||
return `${this.msg}${contextStr}: ${this.span.start}${details}`;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user