]> git.sur5r.net Git - cc65/commitdiff
Fixed a bug in CascadeSwitch
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 24 Jul 2001 20:08:58 +0000 (20:08 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 24 Jul 2001 20:08:58 +0000 (20:08 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@813 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cc65/stmt.c

index 9c2217cee6d60a2fd9f506d1e310391eb75b6562..ab5fd239e2631e6a8401a9371745a60b3850d3a5 100644 (file)
@@ -415,16 +415,18 @@ static void CascadeSwitch (ExprDesc* Expr)
                    /* Emit a compare */
                    g_cmp (Flags, Val);
 
-                   /* If another case follows, we will jump to the code if
-                    * the condition is true.
-                    */
-                   if (CurTok.Tok == TOK_CASE) {
+                   /* If another case follows after the colon (which is 
+                    * currently pending and cannot be skipped since otherwise
+                    * the debug infos will get wrong), we will jump to the 
+                    * code if the condition is true.
+                    */
+                           if (NextTok.Tok == TOK_CASE) {
                        /* Create a code label if needed */
                        if (CodeLab == 0) {
                            CodeLab = GetLocalLabel ();
                        }
                        g_falsejump (CF_NONE, CodeLab);
-                   } else if (CurTok.Tok != TOK_DEFAULT) {
+                   } else if (NextTok.Tok != TOK_DEFAULT) {
                        /* No case follows, jump to next selector */
                        if (NextLab == 0) {
                            NextLab = GetLocalLabel ();