* fixed type conversions from dynamic arrays to open arrays

This commit is contained in:
Jonas Maebe 2001-12-10 14:34:04 +00:00
parent 8ddb738e07
commit cd378a2881
3 changed files with 48 additions and 27 deletions

View File

@ -455,11 +455,6 @@ implementation
end;
location.resflags:=F_NE;
end;
in_reset_typedfile,in_rewrite_typedfile :
begin
{ should be removed in pass_1 (JM) }
internalerror(200108132);
end;
in_setlength_x:
begin
pushusedregisters(pushed,$ff);
@ -548,22 +543,6 @@ implementation
popusedregisters(pushed);
maybe_loadself;
end;
in_read_x,
in_readln_x,
in_write_x,
in_writeln_x :
{ should be removed in the resulttype pass already (JM) }
internalerror(200108162);
in_str_x_string :
begin
{ should be removed in det_resulttype (JM) }
internalerror(200108131);
end;
in_val_x :
Begin
{ should be removed in det_resulttype (JM) }
internalerror(200108241);
End;
in_include_x_y,
in_exclude_x_y:
begin
@ -750,7 +729,10 @@ begin
end.
{
$Log$
Revision 1.29 2001-12-04 15:59:03 jonas
Revision 1.30 2001-12-10 14:34:04 jonas
* fixed type conversions from dynamic arrays to open arrays
Revision 1.29 2001/12/04 15:59:03 jonas
* converted lo/hi to processor independent code, generated code is the
same as before (when turning on the optimizer)

View File

@ -55,6 +55,7 @@ interface
function resulttype_arrayconstructor_to_set : tnode;
function resulttype_pchar_to_string : tnode;
function resulttype_interface_to_guid : tnode;
function resulttype_dynarray_to_openarray : tnode;
function resulttype_call_helper(c : tconverttype) : tnode;
protected
function first_int_to_int : tnode;virtual;
@ -133,7 +134,7 @@ implementation
globtype,systems,tokens,
cutils,verbose,globals,widestr,
symconst,symdef,symsym,symtable,
ncon,ncal,nset,nadd,ninl,
ncon,ncal,nset,nadd,ninl,nmem,
cgbase,
htypechk,pass_1,cpubase,cpuinfo;
@ -731,6 +732,20 @@ implementation
end;
function ttypeconvnode.resulttype_dynarray_to_openarray : tnode;
begin
{ a dynamic array is a pointer to an array, so to convert it to }
{ an open array, we have to dereference it (JM) }
result := ctypeconvnode.create(left,voidpointertype);
{ left is reused }
left := nil;
result.toggleflag(nf_explizit);
result := cderefnode.create(result);
result.resulttype := resulttype;
end;
function ttypeconvnode.resulttype_call_helper(c : tconverttype) : tnode;
const
@ -762,7 +777,8 @@ implementation
{ intf_2_guid } @ttypeconvnode.resulttype_interface_to_guid,
{ class_2_intf } nil,
{ char_2_char } @ttypeconvnode.resulttype_char_to_char,
{ nomal_2_smallset} nil
{ normal_2_smallset} nil,
{ dynarray_2_openarray} @resulttype_dynarray_to_openarray
);
type
tprocedureofobject = function : tnode of object;
@ -1404,6 +1420,7 @@ implementation
@ttypeconvnode.first_nothing,
@ttypeconvnode.first_class_to_intf,
@ttypeconvnode.first_char_to_char,
@ttypeconvnode.first_nothing,
@ttypeconvnode.first_nothing
);
type
@ -1618,7 +1635,10 @@ begin
end.
{
$Log$
Revision 1.46 2001-12-06 17:57:34 florian
Revision 1.47 2001-12-10 14:34:04 jonas
* fixed type conversions from dynamic arrays to open arrays
Revision 1.46 2001/12/06 17:57:34 florian
+ parasym to tparaitem added
Revision 1.45 2001/12/03 21:48:41 peter

View File

@ -186,7 +186,8 @@ interface
tc_intf_2_guid,
tc_class_2_intf,
tc_char_2_char,
tc_normal_2_smallset
tc_normal_2_smallset,
tc_dynarray_2_openarray
);
function assignment_overloaded(from_def,to_def : tdef) : tprocdef;
@ -1174,6 +1175,12 @@ implementation
(is_array_of_const(def2) and is_array_constructor(def1));
end
else
if (is_dynamic_array(def1) or is_dynamic_array(def2)) then
begin
b := is_dynamic_array(def1) and is_dynamic_array(def2) and
is_equal(tarraydef(def1).elementtype.def,tarraydef(def2).elementtype.def);
end
else
if is_open_array(def1) or is_open_array(def2) then
begin
b:=is_equal(tarraydef(def1).elementtype.def,tarraydef(def2).elementtype.def);
@ -1522,6 +1529,15 @@ implementation
b:=2;
end;
end
else
{ dynamic array -> open array }
if is_dynamic_array(def_from) and
is_open_array(def_to) and
is_equal(tarraydef(def_to).elementtype.def,tarraydef(def_from).elementtype.def) then
begin
doconv := tc_dynarray_2_openarray;
b := 2;
end
else
{ array of tvarrec -> array of const }
if is_array_of_const(def_to) and
@ -1869,7 +1885,10 @@ implementation
end.
{
$Log$
Revision 1.58 2001-12-03 21:48:43 peter
Revision 1.59 2001-12-10 14:34:04 jonas
* fixed type conversions from dynamic arrays to open arrays
Revision 1.58 2001/12/03 21:48:43 peter
* freemem change to value parameter
* torddef low/high range changed to int64