|
@@ -1101,6 +1101,8 @@ implementation
|
|
|
|
|
|
{ reads a type definition and returns a pointer to it }
|
|
{ reads a type definition and returns a pointer to it }
|
|
procedure read_named_type(var def:tdef;const newsym:tsym;genericdef:tstoreddef;genericlist:tfphashobjectlist;parseprocvardir:boolean;var hadtypetoken:boolean);
|
|
procedure read_named_type(var def:tdef;const newsym:tsym;genericdef:tstoreddef;genericlist:tfphashobjectlist;parseprocvardir:boolean;var hadtypetoken:boolean);
|
|
|
|
+ const
|
|
|
|
+ SingleTypeOptionsInTypeBlock:array[Boolean] of TSingleTypeOptions = ([],[stoIsForwardDef]);
|
|
var
|
|
var
|
|
pt : tnode;
|
|
pt : tnode;
|
|
tt2 : tdef;
|
|
tt2 : tdef;
|
|
@@ -1353,6 +1355,37 @@ implementation
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
+ procedure pointer_dec;
|
|
|
|
+ var
|
|
|
|
+ sym: tsym;
|
|
|
|
+ begin
|
|
|
|
+ consume(_CARET);
|
|
|
|
+ single_type(tt2,
|
|
|
|
+ SingleTypeOptionsInTypeBlock[block_type=bt_type]+[stoAllowSpecialization]
|
|
|
|
+ );
|
|
|
|
+ { in case of e.g. var or const sections we need to especially
|
|
|
|
+ check that we don't use a generic dummy symbol }
|
|
|
|
+ if (block_type<>bt_type) and
|
|
|
|
+ (tt2.typ=undefineddef) and
|
|
|
|
+ assigned(tt2.typesym) and
|
|
|
|
+ (sp_generic_dummy in tt2.typesym.symoptions) then
|
|
|
|
+ begin
|
|
|
|
+ sym:=resolve_generic_dummysym(tt2.typesym.name);
|
|
|
|
+ if assigned(sym) and
|
|
|
|
+ not (sp_generic_dummy in sym.symoptions) and
|
|
|
|
+ (sym.typ=typesym) then
|
|
|
|
+ tt2:=ttypesym(sym).typedef
|
|
|
|
+ else
|
|
|
|
+ Message(parser_e_no_generics_as_types);
|
|
|
|
+ end;
|
|
|
|
+ { don't use cpointerdef.getreusable() here, since this is a type
|
|
|
|
+ declaration (-> must create new typedef) }
|
|
|
|
+ def:=cpointerdef.create(tt2);
|
|
|
|
+ if tt2.typ=forwarddef then
|
|
|
|
+ current_module.checkforwarddefs.add(def);
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+
|
|
procedure array_dec(is_packed:boolean;genericdef:tstoreddef;genericlist:tfphashobjectlist);
|
|
procedure array_dec(is_packed:boolean;genericdef:tstoreddef;genericlist:tfphashobjectlist);
|
|
var
|
|
var
|
|
isgeneric : boolean;
|
|
isgeneric : boolean;
|
|
@@ -1675,8 +1708,6 @@ implementation
|
|
result:=pd;
|
|
result:=pd;
|
|
end;
|
|
end;
|
|
|
|
|
|
- const
|
|
|
|
- SingleTypeOptionsInTypeBlock:array[Boolean] of TSingleTypeOptions = ([],[stoIsForwardDef]);
|
|
|
|
var
|
|
var
|
|
p : tnode;
|
|
p : tnode;
|
|
hdef : tdef;
|
|
hdef : tdef;
|
|
@@ -1805,40 +1836,11 @@ implementation
|
|
{$endif}
|
|
{$endif}
|
|
end;
|
|
end;
|
|
_ARRAY:
|
|
_ARRAY:
|
|
- begin
|
|
|
|
- array_dec(false,genericdef,genericlist);
|
|
|
|
- end;
|
|
|
|
|
|
+ array_dec(false,genericdef,genericlist);
|
|
_SET:
|
|
_SET:
|
|
- begin
|
|
|
|
- set_dec;
|
|
|
|
- end;
|
|
|
|
- _CARET:
|
|
|
|
- begin
|
|
|
|
- consume(_CARET);
|
|
|
|
- single_type(tt2,
|
|
|
|
- SingleTypeOptionsInTypeBlock[block_type=bt_type]+[stoAllowSpecialization]
|
|
|
|
- );
|
|
|
|
- { in case of e.g. var or const sections we need to especially
|
|
|
|
- check that we don't use a generic dummy symbol }
|
|
|
|
- if (block_type<>bt_type) and
|
|
|
|
- (tt2.typ=undefineddef) and
|
|
|
|
- assigned(tt2.typesym) and
|
|
|
|
- (sp_generic_dummy in tt2.typesym.symoptions) then
|
|
|
|
- begin
|
|
|
|
- sym:=resolve_generic_dummysym(tt2.typesym.name);
|
|
|
|
- if assigned(sym) and
|
|
|
|
- not (sp_generic_dummy in sym.symoptions) and
|
|
|
|
- (sym.typ=typesym) then
|
|
|
|
- tt2:=ttypesym(sym).typedef
|
|
|
|
- else
|
|
|
|
- Message(parser_e_no_generics_as_types);
|
|
|
|
- end;
|
|
|
|
- { don't use cpointerdef.getreusable() here, since this is a type
|
|
|
|
- declaration (-> must create new typedef) }
|
|
|
|
- def:=cpointerdef.create(tt2);
|
|
|
|
- if tt2.typ=forwarddef then
|
|
|
|
- current_module.checkforwarddefs.add(def);
|
|
|
|
- end;
|
|
|
|
|
|
+ set_dec;
|
|
|
|
+ _CARET:
|
|
|
|
+ pointer_dec;
|
|
_RECORD:
|
|
_RECORD:
|
|
begin
|
|
begin
|
|
consume(token);
|
|
consume(token);
|