mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 10:19:30 +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 }
|
||||
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 }
|
||||
|
@ -1312,7 +1312,7 @@ implementation
|
||||
if (htype.def=cvarianttype.def) and
|
||||
not(cs_compilesystem in aktmoduleswitches) then
|
||||
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
|
||||
begin
|
||||
p1:=comp_expr(true);
|
||||
@ -1392,7 +1392,7 @@ implementation
|
||||
{ For a type block we simply return only
|
||||
the type. For all other blocks we return
|
||||
a loadvmt node }
|
||||
if (block_type<>bt_type) then
|
||||
if not(block_type in [bt_type,bt_specialize]) then
|
||||
p1:=cloadvmtaddrnode.create(p1);
|
||||
end;
|
||||
end
|
||||
|
@ -359,7 +359,9 @@ implementation
|
||||
pt1,pt2 : tnode;
|
||||
lv,hv : TConstExprInt;
|
||||
ispecialization : boolean;
|
||||
old_block_type : tblock_type;
|
||||
begin
|
||||
old_block_type:=block_type;
|
||||
{ use of current parsed object:
|
||||
- classes can be used also in classes
|
||||
- objects can be parameters }
|
||||
@ -376,12 +378,13 @@ implementation
|
||||
exit;
|
||||
end;
|
||||
{ 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 }
|
||||
pt1:=comp_expr(not(ignore_equal));
|
||||
if (token=_POINTPOINT) then
|
||||
if (block_type<>bt_specialize) and
|
||||
try_to_consume(_POINTPOINT) then
|
||||
begin
|
||||
consume(_POINTPOINT);
|
||||
{ get high value of range }
|
||||
pt2:=comp_expr(not(ignore_equal));
|
||||
{ make both the same type or give an error. This is not
|
||||
@ -427,7 +430,7 @@ implementation
|
||||
{ a simple type renaming or generic specialization }
|
||||
if (pt1.nodetype=typen) then
|
||||
begin
|
||||
if ispecialization then
|
||||
if (block_type=bt_specialize) then
|
||||
generate_specialization(pt1,name);
|
||||
tt:=ttypenode(pt1).resulttype;
|
||||
end
|
||||
@ -435,6 +438,7 @@ implementation
|
||||
Message(sym_e_error_in_type_def);
|
||||
end;
|
||||
pt1.free;
|
||||
block_type:=old_block_type;
|
||||
end;
|
||||
|
||||
procedure array_dec;
|
||||
|
Loading…
Reference in New Issue
Block a user