diff --git a/ts2panda/src/debuginfo.ts b/ts2panda/src/debuginfo.ts index 8e3b5c8fed18353e0feaff1f4675b2eca1972a78..bc7ffb529de5606d2f8c385eb0fcdcf52b30fd79 100644 --- a/ts2panda/src/debuginfo.ts +++ b/ts2panda/src/debuginfo.ts @@ -189,8 +189,11 @@ export class DebugInfo { pos = node.getStart(); } - let loc = file.getLineAndCharacterOfPosition(pos); - let wholeLineText = tempWholeLineText || node.getText(); + let loc = file.getLineAndCharacterOfPosition(pos); + let wholeLineText = tempWholeLineText; + if (node.pos >= 0 && node.end >= 0) { + wholeLineText = wholeLineText || node.getText() + } return { loc: loc, wholeLineText: wholeLineText