|
@@ -28,7 +28,7 @@ interface
|
|
|
|
|
|
uses
|
|
uses
|
|
node,
|
|
node,
|
|
- symbase,symtype,symsym,symdef;
|
|
|
|
|
|
+ symconst,symbase,symtype,symsym,symdef;
|
|
|
|
|
|
type
|
|
type
|
|
tloadnode = class(tunarynode)
|
|
tloadnode = class(tunarynode)
|
|
@@ -95,6 +95,19 @@ interface
|
|
end;
|
|
end;
|
|
ttypenodeclass = class of ttypenode;
|
|
ttypenodeclass = class of ttypenode;
|
|
|
|
|
|
|
|
+ trttinode = class(tnode)
|
|
|
|
+ l1,l2 : longint;
|
|
|
|
+ rttitype : trttitype;
|
|
|
|
+ rttidef : tstoreddef;
|
|
|
|
+ constructor create(def:tstoreddef;rt:trttitype);virtual;
|
|
|
|
+ function getcopy : tnode;override;
|
|
|
|
+ function pass_1 : tnode;override;
|
|
|
|
+ procedure pass_2;override;
|
|
|
|
+ function det_resulttype:tnode;override;
|
|
|
|
+ function docompare(p: tnode): boolean; override;
|
|
|
|
+ end;
|
|
|
|
+ trttinodeclass = class of trttinode;
|
|
|
|
+
|
|
var
|
|
var
|
|
cloadnode : tloadnodeclass;
|
|
cloadnode : tloadnodeclass;
|
|
cassignmentnode : tassignmentnodeclass;
|
|
cassignmentnode : tassignmentnodeclass;
|
|
@@ -102,15 +115,16 @@ interface
|
|
carrayconstructorrangenode : tarrayconstructorrangenodeclass;
|
|
carrayconstructorrangenode : tarrayconstructorrangenodeclass;
|
|
carrayconstructornode : tarrayconstructornodeclass;
|
|
carrayconstructornode : tarrayconstructornodeclass;
|
|
ctypenode : ttypenodeclass;
|
|
ctypenode : ttypenodeclass;
|
|
|
|
+ crttinode : trttinodeclass;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
implementation
|
|
|
|
|
|
uses
|
|
uses
|
|
cutils,verbose,globtype,globals,systems,
|
|
cutils,verbose,globtype,globals,systems,
|
|
- symconst,symtable,types,
|
|
|
|
|
|
+ symtable,types,
|
|
htypechk,pass_1,
|
|
htypechk,pass_1,
|
|
- ncnv,nmem,cpubase,tgcpu,cgbase
|
|
|
|
|
|
+ ncnv,nmem,ncal,cpubase,tgcpu,cgbase
|
|
;
|
|
;
|
|
|
|
|
|
|
|
|
|
@@ -396,6 +410,8 @@ implementation
|
|
|
|
|
|
|
|
|
|
function tassignmentnode.det_resulttype:tnode;
|
|
function tassignmentnode.det_resulttype:tnode;
|
|
|
|
+ var
|
|
|
|
+ hp,hp2 : tnode;
|
|
begin
|
|
begin
|
|
result:=nil;
|
|
result:=nil;
|
|
resulttype:=voidtype;
|
|
resulttype:=voidtype;
|
|
@@ -420,6 +436,19 @@ implementation
|
|
if is_open_array(left.resulttype.def) then
|
|
if is_open_array(left.resulttype.def) then
|
|
CGMessage(type_e_mismatch);
|
|
CGMessage(type_e_mismatch);
|
|
|
|
|
|
|
|
+ { assigning nil to a dynamic array clears the array }
|
|
|
|
+ if is_dynamic_array(left.resulttype.def) and
|
|
|
|
+ (right.nodetype=niln) then
|
|
|
|
+ begin
|
|
|
|
+ hp := ctypeconvnode.create(left,voidpointertype);
|
|
|
|
+ hp.toggleflag(nf_explizit);
|
|
|
|
+ hp2 := crttinode.create(tstoreddef(left.resulttype.def),initrtti);
|
|
|
|
+ hp := ccallparanode.create(hp2,ccallparanode.create(hp,nil));
|
|
|
|
+ left:=nil;
|
|
|
|
+ result := ccallnode.createintern('fpc_dynarray_clear',hp);
|
|
|
|
+ exit;
|
|
|
|
+ end;
|
|
|
|
+
|
|
{ some string functions don't need conversion, so treat them separatly }
|
|
{ some string functions don't need conversion, so treat them separatly }
|
|
if not (
|
|
if not (
|
|
is_shortstring(left.resulttype.def) and
|
|
is_shortstring(left.resulttype.def) and
|
|
@@ -814,6 +843,63 @@ implementation
|
|
inherited docompare(p);
|
|
inherited docompare(p);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
|
|
+{*****************************************************************************
|
|
|
|
+ TRTTINODE
|
|
|
|
+*****************************************************************************}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ constructor trttinode.create(def:tstoreddef;rt:trttitype);
|
|
|
|
+ begin
|
|
|
|
+ inherited create(rttin);
|
|
|
|
+ rttidef:=def;
|
|
|
|
+ rttitype:=rt;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ function trttinode.getcopy : tnode;
|
|
|
|
+ var
|
|
|
|
+ n : trttinode;
|
|
|
|
+ begin
|
|
|
|
+ n:=trttinode(inherited getcopy);
|
|
|
|
+ n.rttidef:=rttidef;
|
|
|
|
+ n.rttitype:=rttitype;
|
|
|
|
+ result:=n;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ function trttinode.det_resulttype:tnode;
|
|
|
|
+ begin
|
|
|
|
+ { rtti information will be returned as a void pointer }
|
|
|
|
+ result:=nil;
|
|
|
|
+ resulttype:=voidpointertype;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ function trttinode.pass_1 : tnode;
|
|
|
|
+ begin
|
|
|
|
+ result:=nil;
|
|
|
|
+ location.loc:=LOC_MEM;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ function trttinode.docompare(p: tnode): boolean;
|
|
|
|
+ begin
|
|
|
|
+ docompare :=
|
|
|
|
+ inherited docompare(p) and
|
|
|
|
+ (rttidef = trttinode(p).rttidef) and
|
|
|
|
+ (rttitype = trttinode(p).rttitype);
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ procedure trttinode.pass_2;
|
|
|
|
+ begin
|
|
|
|
+ reset_reference(location.reference);
|
|
|
|
+ location.loc:=LOC_MEM;
|
|
|
|
+ location.reference.symbol:=rttidef.get_rtti_label(rttitype);
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+
|
|
begin
|
|
begin
|
|
cloadnode:=tloadnode;
|
|
cloadnode:=tloadnode;
|
|
cassignmentnode:=tassignmentnode;
|
|
cassignmentnode:=tassignmentnode;
|
|
@@ -821,10 +907,14 @@ begin
|
|
carrayconstructorrangenode:=tarrayconstructorrangenode;
|
|
carrayconstructorrangenode:=tarrayconstructorrangenode;
|
|
carrayconstructornode:=tarrayconstructornode;
|
|
carrayconstructornode:=tarrayconstructornode;
|
|
ctypenode:=ttypenode;
|
|
ctypenode:=ttypenode;
|
|
|
|
+ crttinode:=trttinode;
|
|
end.
|
|
end.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.31 2001-12-28 15:02:00 jonas
|
|
|
|
|
|
+ Revision 1.32 2002-01-19 11:52:32 peter
|
|
|
|
+ * dynarr:=nil support added
|
|
|
|
+
|
|
|
|
+ Revision 1.31 2001/12/28 15:02:00 jonas
|
|
* fixed web bug 1684 (it already didn't crash anymore, but it also didn't
|
|
* fixed web bug 1684 (it already didn't crash anymore, but it also didn't
|
|
generate an error) ("merged")
|
|
generate an error) ("merged")
|
|
|
|
|