mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 06:11:35 +02:00
* fixed object field parsing
This commit is contained in:
parent
03ffad8965
commit
e838769af8
@ -1344,58 +1344,72 @@ Begin
|
|||||||
{ probably a variable or normal expression }
|
{ probably a variable or normal expression }
|
||||||
{ or a procedure (such as in CALL ID) }
|
{ or a procedure (such as in CALL ID) }
|
||||||
Begin
|
Begin
|
||||||
InitRef;
|
{ is it a constant ? }
|
||||||
if not SetupVar(actasmpattern) then
|
if SearchIConstant(actasmpattern,l) then
|
||||||
Begin
|
Begin
|
||||||
{ look for special symbols ... }
|
if not (opr.typ in [OPR_NONE,OPR_CONSTANT]) then
|
||||||
if actasmpattern = '__RESULT' then
|
Message(asmr_e_invalid_operand_type);
|
||||||
SetUpResult
|
BuildConstant;
|
||||||
else
|
|
||||||
if actasmpattern = '__SELF' then
|
|
||||||
SetupSelf
|
|
||||||
else
|
|
||||||
if actasmpattern = '__OLDEBP' then
|
|
||||||
SetupOldEBP
|
|
||||||
else
|
|
||||||
{ check for direct symbolic names }
|
|
||||||
{ only if compiling the system unit }
|
|
||||||
if (cs_compilesystem in aktmoduleswitches) then
|
|
||||||
begin
|
|
||||||
if not SetupDirectVar(actasmpattern) then
|
|
||||||
Begin
|
|
||||||
{ not found, finally ... add it anyways ... }
|
|
||||||
Message1(asmr_w_id_supposed_external,actasmpattern);
|
|
||||||
opr.ref.symbol:=newasmsymbol(actasmpattern);
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Message1(sym_e_unknown_id,actasmpattern);
|
|
||||||
end;
|
|
||||||
{ constant expression? }
|
|
||||||
if (opr.typ=OPR_CONSTANT) then
|
|
||||||
begin
|
|
||||||
l:=BuildConstExpression(true,false);
|
|
||||||
{ indexing? }
|
|
||||||
if actasmtoken=AS_LPAREN then
|
|
||||||
begin
|
|
||||||
opr.typ:=OPR_REFERENCE;
|
|
||||||
reset_reference(opr.Ref);
|
|
||||||
opr.Ref.Offset:=l;
|
|
||||||
BuildReference;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
opr.Val:=l;
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
expr:=actasmpattern;
|
InitRef;
|
||||||
Consume(AS_ID);
|
if SetupVar(actasmpattern) then
|
||||||
MaybeRecordOffset;
|
begin
|
||||||
|
expr:=actasmpattern;
|
||||||
|
Consume(AS_ID);
|
||||||
|
MaybeRecordOffset;
|
||||||
|
{ add a constant expression? }
|
||||||
|
if (actasmtoken=AS_PLUS) then
|
||||||
|
begin
|
||||||
|
l:=BuildConstExpression(true,false);
|
||||||
|
if opr.typ=OPR_CONSTANT then
|
||||||
|
inc(opr.val,l)
|
||||||
|
else
|
||||||
|
inc(opr.ref.offset,l);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Begin
|
||||||
|
{ look for special symbols ... }
|
||||||
|
if actasmpattern = '__RESULT' then
|
||||||
|
SetUpResult
|
||||||
|
else
|
||||||
|
if actasmpattern = '__SELF' then
|
||||||
|
SetupSelf
|
||||||
|
else
|
||||||
|
if actasmpattern = '__OLDEBP' then
|
||||||
|
SetupOldEBP
|
||||||
|
else
|
||||||
|
{ check for direct symbolic names }
|
||||||
|
{ only if compiling the system unit }
|
||||||
|
if (cs_compilesystem in aktmoduleswitches) then
|
||||||
|
begin
|
||||||
|
if not SetupDirectVar(actasmpattern) then
|
||||||
|
Begin
|
||||||
|
{ not found, finally ... add it anyways ... }
|
||||||
|
Message1(asmr_w_id_supposed_external,actasmpattern);
|
||||||
|
opr.ref.symbol:=newasmsymbol(actasmpattern);
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Message1(sym_e_unknown_id,actasmpattern);
|
||||||
|
Consume(AS_ID);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{ Do we have a indexing reference, then parse it also }
|
{ Do we have a indexing reference, then parse it also }
|
||||||
if actasmtoken=AS_LPAREN then
|
if actasmtoken=AS_LPAREN then
|
||||||
BuildReference;
|
begin
|
||||||
|
if (opr.typ=OPR_CONSTANT) then
|
||||||
|
begin
|
||||||
|
l:=opr.val;
|
||||||
|
opr.typ:=OPR_REFERENCE;
|
||||||
|
reset_reference(opr.Ref);
|
||||||
|
opr.Ref.Offset:=l;
|
||||||
|
end;
|
||||||
|
BuildReference;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AS_REGISTER: { Register, a variable reference or a constant reference }
|
AS_REGISTER: { Register, a variable reference or a constant reference }
|
||||||
@ -1973,7 +1987,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.59 1999-09-27 23:44:57 peter
|
Revision 1.60 1999-10-01 07:59:20 peter
|
||||||
|
* fixed object field parsing
|
||||||
|
|
||||||
|
Revision 1.59 1999/09/27 23:44:57 peter
|
||||||
* procinfo is now a pointer
|
* procinfo is now a pointer
|
||||||
* support for result setting in sub procedure
|
* support for result setting in sub procedure
|
||||||
|
|
||||||
|
@ -1331,28 +1331,44 @@ Begin
|
|||||||
{ is it a normal variable ? }
|
{ is it a normal variable ? }
|
||||||
Begin
|
Begin
|
||||||
InitRef;
|
InitRef;
|
||||||
if not SetupVar(actasmpattern) then
|
if SetupVar(actasmpattern) then
|
||||||
|
begin
|
||||||
|
expr:=actasmpattern;
|
||||||
|
Consume(AS_ID);
|
||||||
|
MaybeRecordOffset;
|
||||||
|
{ add a constant expression? }
|
||||||
|
if (actasmtoken=AS_PLUS) then
|
||||||
|
begin
|
||||||
|
l:=BuildConstExpression;
|
||||||
|
if opr.typ=OPR_CONSTANT then
|
||||||
|
inc(opr.val,l)
|
||||||
|
else
|
||||||
|
inc(opr.ref.offset,l);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
Begin
|
Begin
|
||||||
{ not a variable, check special variables.. }
|
{ not a variable, check special variables.. }
|
||||||
if actasmpattern = 'SELF' then
|
if actasmpattern = 'SELF' then
|
||||||
SetupSelf
|
SetupSelf
|
||||||
else
|
else
|
||||||
Message1(sym_e_unknown_id,actasmpattern);
|
Message1(sym_e_unknown_id,actasmpattern);
|
||||||
end;
|
Consume(AS_ID);
|
||||||
expr:=actasmpattern;
|
|
||||||
Consume(AS_ID);
|
|
||||||
MaybeRecordOffset;
|
|
||||||
if actasmtoken=AS_LBRACKET then
|
|
||||||
begin
|
|
||||||
if opr.typ<>OPR_REFERENCE then
|
|
||||||
begin
|
|
||||||
opr.typ:=OPR_REFERENCE;
|
|
||||||
reset_reference(opr.Ref);
|
|
||||||
end;
|
|
||||||
BuildReference;
|
|
||||||
MaybeRecordOffset;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{ handle references }
|
||||||
|
if actasmtoken=AS_LBRACKET then
|
||||||
|
begin
|
||||||
|
if opr.typ=OPR_CONSTANT then
|
||||||
|
begin
|
||||||
|
l:=opr.val;
|
||||||
|
opr.typ:=OPR_REFERENCE;
|
||||||
|
reset_reference(opr.Ref);
|
||||||
|
opr.Ref.Offset:=l;
|
||||||
|
end;
|
||||||
|
BuildReference;
|
||||||
|
MaybeRecordOffset;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1751,7 +1767,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.49 1999-09-27 23:44:58 peter
|
Revision 1.50 1999-10-01 07:59:21 peter
|
||||||
|
* fixed object field parsing
|
||||||
|
|
||||||
|
Revision 1.49 1999/09/27 23:44:58 peter
|
||||||
* procinfo is now a pointer
|
* procinfo is now a pointer
|
||||||
* support for result setting in sub procedure
|
* support for result setting in sub procedure
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user