mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 10:09:20 +02:00
* support Type[index] typecasting
git-svn-id: trunk@711 -
This commit is contained in:
parent
efdbe66a2f
commit
03c02cdb42
@ -1622,14 +1622,26 @@ Unit Ra386int;
|
|||||||
if SearchType(expr,typesize) then
|
if SearchType(expr,typesize) then
|
||||||
begin
|
begin
|
||||||
oper.hastype:=true;
|
oper.hastype:=true;
|
||||||
if (actasmtoken=AS_LPAREN) then
|
case actasmtoken of
|
||||||
|
AS_LPAREN :
|
||||||
begin
|
begin
|
||||||
|
{ Support Type([Reference]) }
|
||||||
Consume(AS_LPAREN);
|
Consume(AS_LPAREN);
|
||||||
BuildOperand(oper);
|
BuildOperand(oper);
|
||||||
Consume(AS_RPAREN);
|
Consume(AS_RPAREN);
|
||||||
if oper.opr.typ in [OPR_REFERENCE,OPR_LOCAL] then
|
if oper.opr.typ in [OPR_REFERENCE,OPR_LOCAL] then
|
||||||
oper.SetSize(typesize,true);
|
oper.SetSize(typesize,true);
|
||||||
end;
|
end;
|
||||||
|
AS_LBRACKET :
|
||||||
|
begin
|
||||||
|
{ Support Var.Type[Index] }
|
||||||
|
{ Convert @label.Byte[1] to reference }
|
||||||
|
if oper.opr.typ=OPR_SYMBOL then
|
||||||
|
oper.initref;
|
||||||
|
if oper.opr.typ in [OPR_REFERENCE,OPR_LOCAL] then
|
||||||
|
oper.SetSize(typesize,true);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
@ -944,6 +944,8 @@ procedure TOperand.InitRef;
|
|||||||
{*********************************************************************}
|
{*********************************************************************}
|
||||||
var
|
var
|
||||||
l : aint;
|
l : aint;
|
||||||
|
hsymofs : aint;
|
||||||
|
hsymbol : tasmsymbol;
|
||||||
reg : tregister;
|
reg : tregister;
|
||||||
Begin
|
Begin
|
||||||
case opr.typ of
|
case opr.typ of
|
||||||
@ -968,6 +970,15 @@ Begin
|
|||||||
Fillchar(opr.ref,sizeof(treference),0);
|
Fillchar(opr.ref,sizeof(treference),0);
|
||||||
opr.Ref.base:=reg;
|
opr.Ref.base:=reg;
|
||||||
end;
|
end;
|
||||||
|
OPR_SYMBOL :
|
||||||
|
begin
|
||||||
|
hsymbol:=opr.symbol;
|
||||||
|
hsymofs:=opr.symofs;
|
||||||
|
opr.typ:=OPR_REFERENCE;
|
||||||
|
Fillchar(opr.ref,sizeof(treference),0);
|
||||||
|
opr.ref.symbol:=hsymbol;
|
||||||
|
opr.ref.offset:=hsymofs;
|
||||||
|
end;
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Message(asmr_e_invalid_operand_type);
|
Message(asmr_e_invalid_operand_type);
|
||||||
@ -1346,6 +1357,16 @@ Begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{ Support Field.Type as typecasting }
|
||||||
|
if (st=nil) and (s<>'') then
|
||||||
|
begin
|
||||||
|
asmsearchsym(s,sym,srsymtable);
|
||||||
|
if assigned(sym) and (sym.typ=typesym) then
|
||||||
|
begin
|
||||||
|
size:=ttypesym(sym).restype.def.size;
|
||||||
|
s:=''
|
||||||
|
end;
|
||||||
|
end;
|
||||||
GetRecordOffsetSize:=(s='');
|
GetRecordOffsetSize:=(s='');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user