mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-03 10:29:41 +00:00
Support += and -= operators on function parameters declared using array syntax (which are adjusted to have pointer type).
This fixes the compca25.c test case.
This commit is contained in:
parent
c77bca8389
commit
3b9101ea30
@ -2892,7 +2892,8 @@ case tree^.token.kind of
|
|||||||
begin
|
begin
|
||||||
L_Value(tree^.left);
|
L_Value(tree^.left);
|
||||||
if (token.kind = ident)
|
if (token.kind = ident)
|
||||||
and (id^.itype^.kind in [scalarType,pointerType]) then begin
|
and ((id^.itype^.kind in [scalarType,pointerType])
|
||||||
|
or ((id^.itype^.kind = arrayType) and (id^.storage = parameter))) then begin
|
||||||
doingScalar := true;
|
doingScalar := true;
|
||||||
LoadScalar(id);
|
LoadScalar(id);
|
||||||
lType := id^.itype;
|
lType := id^.itype;
|
||||||
@ -2922,13 +2923,18 @@ case tree^.token.kind of
|
|||||||
end; {else}
|
end; {else}
|
||||||
if lType^.isConstant then
|
if lType^.isConstant then
|
||||||
Error(93);
|
Error(93);
|
||||||
|
if doingScalar
|
||||||
|
and (ltype^.kind = arrayType) and (id^.storage = parameter) then
|
||||||
|
kind := pointerType
|
||||||
|
else
|
||||||
|
kind := lType^.kind;
|
||||||
GenerateCode(tree^.right);
|
GenerateCode(tree^.right);
|
||||||
if lType^.kind <> pointerType then
|
if kind <> pointerType then
|
||||||
et := UsualBinaryConversions(lType);
|
et := UsualBinaryConversions(lType);
|
||||||
case tree^.token.kind of
|
case tree^.token.kind of
|
||||||
|
|
||||||
pluseqop:
|
pluseqop:
|
||||||
if lType^.kind = pointerType then begin
|
if kind = pointerType then begin
|
||||||
ChangePointer(pc_adl, lType^.pType^.size, UsualUnaryConversions);
|
ChangePointer(pc_adl, lType^.pType^.size, UsualUnaryConversions);
|
||||||
expressionType := lType;
|
expressionType := lType;
|
||||||
end
|
end
|
||||||
@ -2942,7 +2948,7 @@ case tree^.token.kind of
|
|||||||
Error(66);
|
Error(66);
|
||||||
|
|
||||||
minuseqop:
|
minuseqop:
|
||||||
if lType^.kind = pointerType then begin
|
if kind = pointerType then begin
|
||||||
ChangePointer(pc_sbl, lType^.pType^.size, UsualUnaryConversions);
|
ChangePointer(pc_sbl, lType^.pType^.size, UsualUnaryConversions);
|
||||||
expressionType := lType;
|
expressionType := lType;
|
||||||
end
|
end
|
||||||
@ -3043,7 +3049,7 @@ case tree^.token.kind of
|
|||||||
end; {case}
|
end; {case}
|
||||||
AssignmentConversion(lType,expressionType,false,0,true,true);
|
AssignmentConversion(lType,expressionType,false,0,true,true);
|
||||||
if doingScalar then begin
|
if doingScalar then begin
|
||||||
if lType^.kind = pointerType then
|
if kind = pointerType then
|
||||||
lType := uLongPtr;
|
lType := uLongPtr;
|
||||||
case id^.storage of
|
case id^.storage of
|
||||||
stackFrame, parameter:
|
stackFrame, parameter:
|
||||||
|
Loading…
Reference in New Issue
Block a user