From 7596da75f024b9c6e74735d60bff847ca173483a Mon Sep 17 00:00:00 2001 From: cuz Date: Tue, 19 Aug 2003 20:30:55 +0000 Subject: [PATCH] Fixed an internal compiler error when the first token of a source file caused an error message. In this case, the line info was not available leading to a PRECONDITION VIOLATED. git-svn-id: svn://svn.cc65.org/cc65/trunk@2370 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/scanner.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/cc65/scanner.c b/src/cc65/scanner.c index 183898ff1..e87126f41 100644 --- a/src/cc65/scanner.c +++ b/src/cc65/scanner.c @@ -396,6 +396,14 @@ void NextToken (void) } CurTok = NextTok; + /* When reading the first time from the file, the line info in NextTok, + * which was copied to CurTok is invalid. Since the information from + * the token is used for error messages, we must make it valid. + */ + if (CurTok.LI == 0) { + CurTok.LI = UseLineInfo (GetCurLineInfo ()); + } + /* Remember the starting position of the next token */ NextTok.LI = UseLineInfo (GetCurLineInfo ()); -- 2.39.2