mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-26 00:01:47 +02:00
* fix parsing of typecasts in type declarations
git-svn-id: trunk@2026 -
This commit is contained in:
parent
5ff0e08283
commit
80fef1e8ad
@ -177,7 +177,7 @@ than 255 characters. That's why using Ansi Strings}
|
|||||||
|
|
||||||
{ currently parsed block type }
|
{ currently parsed block type }
|
||||||
tblock_type = (bt_none,
|
tblock_type = (bt_none,
|
||||||
bt_general,bt_type,bt_const,bt_except,bt_body
|
bt_general,bt_type,bt_const,bt_except,bt_body,bt_specialize
|
||||||
);
|
);
|
||||||
|
|
||||||
{ Temp types }
|
{ Temp types }
|
||||||
|
|||||||
@ -1312,7 +1312,7 @@ implementation
|
|||||||
if (htype.def=cvarianttype.def) and
|
if (htype.def=cvarianttype.def) and
|
||||||
not(cs_compilesystem in aktmoduleswitches) then
|
not(cs_compilesystem in aktmoduleswitches) then
|
||||||
current_module.flags:=current_module.flags or uf_uses_variants;
|
current_module.flags:=current_module.flags or uf_uses_variants;
|
||||||
if (block_type<>bt_type) and
|
if (block_type<>bt_specialize) and
|
||||||
try_to_consume(_LKLAMMER) then
|
try_to_consume(_LKLAMMER) then
|
||||||
begin
|
begin
|
||||||
p1:=comp_expr(true);
|
p1:=comp_expr(true);
|
||||||
@ -1392,7 +1392,7 @@ implementation
|
|||||||
{ For a type block we simply return only
|
{ For a type block we simply return only
|
||||||
the type. For all other blocks we return
|
the type. For all other blocks we return
|
||||||
a loadvmt node }
|
a loadvmt node }
|
||||||
if (block_type<>bt_type) then
|
if not(block_type in [bt_type,bt_specialize]) then
|
||||||
p1:=cloadvmtaddrnode.create(p1);
|
p1:=cloadvmtaddrnode.create(p1);
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
|||||||
@ -359,7 +359,9 @@ implementation
|
|||||||
pt1,pt2 : tnode;
|
pt1,pt2 : tnode;
|
||||||
lv,hv : TConstExprInt;
|
lv,hv : TConstExprInt;
|
||||||
ispecialization : boolean;
|
ispecialization : boolean;
|
||||||
|
old_block_type : tblock_type;
|
||||||
begin
|
begin
|
||||||
|
old_block_type:=block_type;
|
||||||
{ use of current parsed object:
|
{ use of current parsed object:
|
||||||
- classes can be used also in classes
|
- classes can be used also in classes
|
||||||
- objects can be parameters }
|
- objects can be parameters }
|
||||||
@ -376,12 +378,13 @@ implementation
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{ Generate a specialization? }
|
{ Generate a specialization? }
|
||||||
ispecialization:=try_to_consume(_SPECIALIZE);
|
if try_to_consume(_SPECIALIZE) then
|
||||||
|
block_type:=bt_specialize;
|
||||||
{ we can't accept a equal in type }
|
{ we can't accept a equal in type }
|
||||||
pt1:=comp_expr(not(ignore_equal));
|
pt1:=comp_expr(not(ignore_equal));
|
||||||
if (token=_POINTPOINT) then
|
if (block_type<>bt_specialize) and
|
||||||
|
try_to_consume(_POINTPOINT) then
|
||||||
begin
|
begin
|
||||||
consume(_POINTPOINT);
|
|
||||||
{ get high value of range }
|
{ get high value of range }
|
||||||
pt2:=comp_expr(not(ignore_equal));
|
pt2:=comp_expr(not(ignore_equal));
|
||||||
{ make both the same type or give an error. This is not
|
{ make both the same type or give an error. This is not
|
||||||
@ -427,7 +430,7 @@ implementation
|
|||||||
{ a simple type renaming or generic specialization }
|
{ a simple type renaming or generic specialization }
|
||||||
if (pt1.nodetype=typen) then
|
if (pt1.nodetype=typen) then
|
||||||
begin
|
begin
|
||||||
if ispecialization then
|
if (block_type=bt_specialize) then
|
||||||
generate_specialization(pt1,name);
|
generate_specialization(pt1,name);
|
||||||
tt:=ttypenode(pt1).resulttype;
|
tt:=ttypenode(pt1).resulttype;
|
||||||
end
|
end
|
||||||
@ -435,6 +438,7 @@ implementation
|
|||||||
Message(sym_e_error_in_type_def);
|
Message(sym_e_error_in_type_def);
|
||||||
end;
|
end;
|
||||||
pt1.free;
|
pt1.free;
|
||||||
|
block_type:=old_block_type;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure array_dec;
|
procedure array_dec;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user