fix: variable sets were handled wrong
This commit is contained in:
parent
3883f47fd0
commit
956fa21b89
|
@ -425,11 +425,12 @@ ChkSet(expp)
|
||||||
register struct def *df;
|
register struct def *df;
|
||||||
unsigned size;
|
unsigned size;
|
||||||
int retval = 1;
|
int retval = 1;
|
||||||
|
int SetIsConstant = 1;
|
||||||
|
|
||||||
assert(expp->nd_symb == SET);
|
assert(expp->nd_symb == SET);
|
||||||
|
|
||||||
expp->nd_class = Set;
|
|
||||||
expp->nd_type = error_type;
|
expp->nd_type = error_type;
|
||||||
|
expp->nd_class = Set;
|
||||||
|
|
||||||
/* First determine the type of the set
|
/* First determine the type of the set
|
||||||
*/
|
*/
|
||||||
|
@ -472,10 +473,11 @@ ChkSet(expp)
|
||||||
expp->nd_set)) {
|
expp->nd_set)) {
|
||||||
retval = 0;
|
retval = 0;
|
||||||
}
|
}
|
||||||
|
if (nd->nd_left) SetIsConstant = 0;
|
||||||
nd = nd->nd_right;
|
nd = nd->nd_right;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expp->nd_class == Set) {
|
if (SetIsConstant) {
|
||||||
FreeNode(expp->nd_right);
|
FreeNode(expp->nd_right);
|
||||||
expp->nd_right = 0;
|
expp->nd_right = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,12 +57,21 @@ statement(register struct node **pnd;)
|
||||||
|
|
|
|
||||||
CaseStatement(pnd)
|
CaseStatement(pnd)
|
||||||
|
|
|
|
||||||
WhileStatement(pnd)
|
WHILE { *pnd = nd = MkLeaf(Stat, &dot); }
|
||||||
|
expression(&(nd->nd_left))
|
||||||
|
DO
|
||||||
|
StatementSequence(&(nd->nd_right))
|
||||||
|
END
|
||||||
|
|
|
|
||||||
RepeatStatement(pnd)
|
REPEAT { *pnd = nd = MkLeaf(Stat, &dot); }
|
||||||
|
StatementSequence(&(nd->nd_left))
|
||||||
|
UNTIL
|
||||||
|
expression(&(nd->nd_right))
|
||||||
|
|
|
|
||||||
{ loopcount++; }
|
{ loopcount++; }
|
||||||
LoopStatement(pnd)
|
LOOP { *pnd = nd = MkLeaf(Stat, &dot); }
|
||||||
|
StatementSequence(&((*pnd)->nd_right))
|
||||||
|
END
|
||||||
{ loopcount--; }
|
{ loopcount--; }
|
||||||
|
|
|
|
||||||
ForStatement(pnd)
|
ForStatement(pnd)
|
||||||
|
@ -176,6 +185,7 @@ case(struct node **pnd; struct type **ptp;) :
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/* inline in statement; lack of space
|
||||||
WhileStatement(struct node **pnd;)
|
WhileStatement(struct node **pnd;)
|
||||||
{
|
{
|
||||||
register struct node *nd;
|
register struct node *nd;
|
||||||
|
@ -196,6 +206,7 @@ RepeatStatement(struct node **pnd;)
|
||||||
UNTIL
|
UNTIL
|
||||||
expression(&(nd->nd_right))
|
expression(&(nd->nd_right))
|
||||||
;
|
;
|
||||||
|
*/
|
||||||
|
|
||||||
ForStatement(struct node **pnd;)
|
ForStatement(struct node **pnd;)
|
||||||
{
|
{
|
||||||
|
@ -225,11 +236,13 @@ ForStatement(struct node **pnd;)
|
||||||
END
|
END
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/* inline in Statement; lack of space
|
||||||
LoopStatement(struct node **pnd;):
|
LoopStatement(struct node **pnd;):
|
||||||
LOOP { *pnd = MkLeaf(Stat, &dot); }
|
LOOP { *pnd = MkLeaf(Stat, &dot); }
|
||||||
StatementSequence(&((*pnd)->nd_right))
|
StatementSequence(&((*pnd)->nd_right))
|
||||||
END
|
END
|
||||||
;
|
;
|
||||||
|
*/
|
||||||
|
|
||||||
WithStatement(struct node **pnd;)
|
WithStatement(struct node **pnd;)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue