Fixed asm code to source line relation in switch statements. The switch code
was incorrectly attributed to the line following the switch statement. git-svn-id: svn://svn.cc65.org/cc65/trunk@3957 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -93,6 +93,7 @@ void SwitchStatement (void)
|
|||||||
unsigned ExitLabel; /* Exit label */
|
unsigned ExitLabel; /* Exit label */
|
||||||
unsigned SwitchCodeLabel;/* Label for the switch code */
|
unsigned SwitchCodeLabel;/* Label for the switch code */
|
||||||
int HaveBreak = 0; /* True if the last statement had a break */
|
int HaveBreak = 0; /* True if the last statement had a break */
|
||||||
|
int RCurlyBrace; /* True if last token is right curly brace */
|
||||||
SwitchCtrl* OldSwitch; /* Pointer to old switch control data */
|
SwitchCtrl* OldSwitch; /* Pointer to old switch control data */
|
||||||
SwitchCtrl SwitchData; /* New switch data */
|
SwitchCtrl SwitchData; /* New switch data */
|
||||||
|
|
||||||
@@ -151,7 +152,7 @@ void SwitchStatement (void)
|
|||||||
/* Parse the following statement, which will actually be a compound
|
/* Parse the following statement, which will actually be a compound
|
||||||
* statement because of the curly brace at the current input position
|
* statement because of the curly brace at the current input position
|
||||||
*/
|
*/
|
||||||
HaveBreak = Statement (0);
|
HaveBreak = Statement (&RCurlyBrace);
|
||||||
|
|
||||||
/* Check if we had any labels */
|
/* Check if we had any labels */
|
||||||
if (CollCount (SwitchData.Nodes) == 0 && SwitchData.DefaultLabel == 0) {
|
if (CollCount (SwitchData.Nodes) == 0 && SwitchData.DefaultLabel == 0) {
|
||||||
@@ -197,6 +198,13 @@ void SwitchStatement (void)
|
|||||||
|
|
||||||
/* Free the case value tree */
|
/* Free the case value tree */
|
||||||
FreeCaseNodeColl (SwitchData.Nodes);
|
FreeCaseNodeColl (SwitchData.Nodes);
|
||||||
|
|
||||||
|
/* If the case statement was (correctly) terminated by a closing curly
|
||||||
|
* brace, skip it now.
|
||||||
|
*/
|
||||||
|
if (RCurlyBrace) {
|
||||||
|
NextToken ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user