From c6aa02bb068f36b3ab501c283c4dc535be99b63b Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Fri, 25 Dec 2020 15:31:08 +0200 Subject: [PATCH] Expose SourceLocation in ParseError object --- src/parser/ParseError.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/parser/ParseError.ts b/src/parser/ParseError.ts index d8165c8..d6dae6b 100644 --- a/src/parser/ParseError.ts +++ b/src/parser/ParseError.ts @@ -1,7 +1,9 @@ import { SourceLocation } from "./tokenizer"; export class ParseError extends Error { - constructor(msg: string, { row, col }: SourceLocation) { - super(`${msg} at line ${row + 1} char ${col + 1}`); + public loc: SourceLocation; + constructor(msg: string, loc: SourceLocation) { + super(`${msg} at line ${loc.row + 1} char ${loc.col + 1}`); + this.loc = loc; } }