Fixed problems with unnamed labels
git-svn-id: svn://svn.cc65.org/cc65/trunk@3160 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -113,7 +113,7 @@ ExprNode* ULabRef (int Which)
|
||||
if (Which > 0) {
|
||||
--Which;
|
||||
}
|
||||
Index = (int) CollCount (&ULabList) + Which;
|
||||
Index = (int) ULabDefCount + Which;
|
||||
|
||||
/* We cannot have negative label indices */
|
||||
if (Index < 0) {
|
||||
@@ -123,19 +123,27 @@ ExprNode* ULabRef (int Which)
|
||||
return GenCurrentPC();
|
||||
}
|
||||
|
||||
/* If the label does already exist, return it's value, otherwise create
|
||||
* enough forward references, and return a label reference.
|
||||
*/
|
||||
/* Check if the label exists. If not, generate enough forward labels. */
|
||||
if (Index < (int) CollCount (&ULabList)) {
|
||||
/* The label exists, get it. */
|
||||
L = CollAtUnchecked (&ULabList, Index);
|
||||
++L->Ref;
|
||||
return CloneExpr (L->Val);
|
||||
} else {
|
||||
/* Generate new, undefined labels */
|
||||
while (Index >= (int) CollCount (&ULabList)) {
|
||||
L = NewULabel (0);
|
||||
}
|
||||
++L->Ref;
|
||||
return GenULabelExpr (Index);
|
||||
}
|
||||
|
||||
/* Mark the label as referenced */
|
||||
++L->Ref;
|
||||
|
||||
/* If the label is already defined, return its value, otherwise return
|
||||
* just a reference.
|
||||
*/
|
||||
if (L->Val) {
|
||||
return CloneExpr (L->Val);
|
||||
} else {
|
||||
return GenULabelExpr (Index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user