|
@@ -697,6 +697,16 @@ implementation
|
|
fields_allowed, is_classdef, classfields, threadvarfields: boolean;
|
|
fields_allowed, is_classdef, classfields, threadvarfields: boolean;
|
|
vdoptions: tvar_dec_options;
|
|
vdoptions: tvar_dec_options;
|
|
rtti_attrs_def: trtti_attribute_list;
|
|
rtti_attrs_def: trtti_attribute_list;
|
|
|
|
+ fldCount : Integer;
|
|
|
|
+
|
|
|
|
+ procedure check_unbound_attributes;
|
|
|
|
+ begin
|
|
|
|
+ if assigned(rtti_attrs_def) and (rtti_attrs_def.get_attribute_count>0) then
|
|
|
|
+ Message1(parser_e_unbound_attribute,trtti_attribute(rtti_attrs_def.rtti_attributes[0]).typesym.prettyname);
|
|
|
|
+ rtti_attrs_def.free;
|
|
|
|
+ rtti_attrs_def:=nil;
|
|
|
|
+ end;
|
|
|
|
+
|
|
begin
|
|
begin
|
|
{ empty record declaration ? }
|
|
{ empty record declaration ? }
|
|
if (token=_SEMICOLON) then
|
|
if (token=_SEMICOLON) then
|
|
@@ -722,6 +732,7 @@ implementation
|
|
case token of
|
|
case token of
|
|
_TYPE :
|
|
_TYPE :
|
|
begin
|
|
begin
|
|
|
|
+ check_unbound_attributes;
|
|
consume(_TYPE);
|
|
consume(_TYPE);
|
|
member_blocktype:=bt_type;
|
|
member_blocktype:=bt_type;
|
|
|
|
|
|
@@ -731,6 +742,7 @@ implementation
|
|
end;
|
|
end;
|
|
_VAR :
|
|
_VAR :
|
|
begin
|
|
begin
|
|
|
|
+ check_unbound_attributes;
|
|
consume(_VAR);
|
|
consume(_VAR);
|
|
fields_allowed:=true;
|
|
fields_allowed:=true;
|
|
member_blocktype:=bt_general;
|
|
member_blocktype:=bt_general;
|
|
@@ -740,6 +752,7 @@ implementation
|
|
end;
|
|
end;
|
|
_THREADVAR :
|
|
_THREADVAR :
|
|
begin
|
|
begin
|
|
|
|
+ check_unbound_attributes;
|
|
if not is_classdef then
|
|
if not is_classdef then
|
|
begin
|
|
begin
|
|
message(parser_e_threadvar_must_be_class);
|
|
message(parser_e_threadvar_must_be_class);
|
|
@@ -755,6 +768,7 @@ implementation
|
|
end;
|
|
end;
|
|
_CONST:
|
|
_CONST:
|
|
begin
|
|
begin
|
|
|
|
+ check_unbound_attributes;
|
|
consume(_CONST);
|
|
consume(_CONST);
|
|
member_blocktype:=bt_const;
|
|
member_blocktype:=bt_const;
|
|
|
|
|
|
@@ -767,6 +781,7 @@ implementation
|
|
case idtoken of
|
|
case idtoken of
|
|
_PRIVATE :
|
|
_PRIVATE :
|
|
begin
|
|
begin
|
|
|
|
+ check_unbound_attributes;
|
|
consume(_PRIVATE);
|
|
consume(_PRIVATE);
|
|
current_structdef.symtable.currentvisibility:=vis_private;
|
|
current_structdef.symtable.currentvisibility:=vis_private;
|
|
include(current_structdef.objectoptions,oo_has_private);
|
|
include(current_structdef.objectoptions,oo_has_private);
|
|
@@ -778,6 +793,7 @@ implementation
|
|
end;
|
|
end;
|
|
_PROTECTED :
|
|
_PROTECTED :
|
|
begin
|
|
begin
|
|
|
|
+ check_unbound_attributes;
|
|
Message1(parser_e_not_allowed_in_record,tokeninfo^[_PROTECTED].str);
|
|
Message1(parser_e_not_allowed_in_record,tokeninfo^[_PROTECTED].str);
|
|
consume(_PROTECTED);
|
|
consume(_PROTECTED);
|
|
current_structdef.symtable.currentvisibility:=vis_protected;
|
|
current_structdef.symtable.currentvisibility:=vis_protected;
|
|
@@ -790,6 +806,7 @@ implementation
|
|
end;
|
|
end;
|
|
_PUBLIC :
|
|
_PUBLIC :
|
|
begin
|
|
begin
|
|
|
|
+ check_unbound_attributes;
|
|
consume(_PUBLIC);
|
|
consume(_PUBLIC);
|
|
current_structdef.symtable.currentvisibility:=vis_public;
|
|
current_structdef.symtable.currentvisibility:=vis_public;
|
|
fields_allowed:=true;
|
|
fields_allowed:=true;
|
|
@@ -800,6 +817,7 @@ implementation
|
|
end;
|
|
end;
|
|
_PUBLISHED :
|
|
_PUBLISHED :
|
|
begin
|
|
begin
|
|
|
|
+ check_unbound_attributes;
|
|
Message(parser_e_no_record_published);
|
|
Message(parser_e_no_record_published);
|
|
consume(_PUBLISHED);
|
|
consume(_PUBLISHED);
|
|
current_structdef.symtable.currentvisibility:=vis_published;
|
|
current_structdef.symtable.currentvisibility:=vis_published;
|
|
@@ -844,6 +862,7 @@ implementation
|
|
else
|
|
else
|
|
if is_classdef and (idtoken=_OPERATOR) then
|
|
if is_classdef and (idtoken=_OPERATOR) then
|
|
begin
|
|
begin
|
|
|
|
+ check_unbound_attributes;
|
|
pd:=parse_record_method_dec(current_structdef,is_classdef,false);
|
|
pd:=parse_record_method_dec(current_structdef,is_classdef,false);
|
|
fields_allowed:=false;
|
|
fields_allowed:=false;
|
|
is_classdef:=false;
|
|
is_classdef:=false;
|
|
@@ -874,7 +893,17 @@ implementation
|
|
include(vdoptions,vd_check_generic);
|
|
include(vdoptions,vd_check_generic);
|
|
if threadvarfields then
|
|
if threadvarfields then
|
|
include(vdoptions,vd_threadvar);
|
|
include(vdoptions,vd_threadvar);
|
|
|
|
+ fldCount:=current_structdef.symtable.SymList.Count;
|
|
read_record_fields(vdoptions,nil,nil,hadgeneric);
|
|
read_record_fields(vdoptions,nil,nil,hadgeneric);
|
|
|
|
+ if assigned(rtti_attrs_def) then
|
|
|
|
+ begin
|
|
|
|
+ While (fldCount+1<current_structdef.symtable.SymList.Count) do
|
|
|
|
+ begin
|
|
|
|
+ trtti_attribute_list.copyandbind(rtti_attrs_def,(current_structdef.symtable.SymList[fldCount] as tfieldvarsym).rtti_attribute_list);
|
|
|
|
+ inc(fldcount);
|
|
|
|
+ end;
|
|
|
|
+ trtti_attribute_list.bind(rtti_attrs_def,(current_structdef.symtable.SymList[fldCount] as tfieldvarsym).rtti_attribute_list);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
end
|
|
end
|
|
else if member_blocktype=bt_type then
|
|
else if member_blocktype=bt_type then
|
|
@@ -896,6 +925,7 @@ implementation
|
|
end;
|
|
end;
|
|
_CLASS:
|
|
_CLASS:
|
|
begin
|
|
begin
|
|
|
|
+ check_unbound_attributes;
|
|
is_classdef:=false;
|
|
is_classdef:=false;
|
|
{ read class method/field/property }
|
|
{ read class method/field/property }
|
|
consume(_CLASS);
|
|
consume(_CLASS);
|
|
@@ -914,6 +944,7 @@ implementation
|
|
_PROCEDURE,
|
|
_PROCEDURE,
|
|
_FUNCTION:
|
|
_FUNCTION:
|
|
begin
|
|
begin
|
|
|
|
+ check_unbound_attributes;
|
|
if IsAnonOrLocal then
|
|
if IsAnonOrLocal then
|
|
Message(parser_e_no_methods_in_local_anonymous_records);
|
|
Message(parser_e_no_methods_in_local_anonymous_records);
|
|
pd:=parse_record_method_dec(current_structdef,is_classdef,hadgeneric);
|
|
pd:=parse_record_method_dec(current_structdef,is_classdef,hadgeneric);
|
|
@@ -923,6 +954,7 @@ implementation
|
|
end;
|
|
end;
|
|
_CONSTRUCTOR :
|
|
_CONSTRUCTOR :
|
|
begin
|
|
begin
|
|
|
|
+ check_unbound_attributes;
|
|
if IsAnonOrLocal then
|
|
if IsAnonOrLocal then
|
|
Message(parser_e_no_methods_in_local_anonymous_records);
|
|
Message(parser_e_no_methods_in_local_anonymous_records);
|
|
if not is_classdef and (current_structdef.symtable.currentvisibility <> vis_public) then
|
|
if not is_classdef and (current_structdef.symtable.currentvisibility <> vis_public) then
|
|
@@ -949,6 +981,7 @@ implementation
|
|
end;
|
|
end;
|
|
_DESTRUCTOR :
|
|
_DESTRUCTOR :
|
|
begin
|
|
begin
|
|
|
|
+ check_unbound_attributes;
|
|
if IsAnonOrLocal then
|
|
if IsAnonOrLocal then
|
|
Message(parser_e_no_methods_in_local_anonymous_records);
|
|
Message(parser_e_no_methods_in_local_anonymous_records);
|
|
if not is_classdef then
|
|
if not is_classdef then
|
|
@@ -969,6 +1002,13 @@ implementation
|
|
fields_allowed:=false;
|
|
fields_allowed:=false;
|
|
is_classdef:=false;
|
|
is_classdef:=false;
|
|
end;
|
|
end;
|
|
|
|
+ _LECKKLAMMER:
|
|
|
|
+ begin
|
|
|
|
+ if m_prefixed_attributes in current_settings.modeswitches then
|
|
|
|
+ parse_rttiattributes(rtti_attrs_def)
|
|
|
|
+ else
|
|
|
|
+ consume(_ID);
|
|
|
|
+ end;
|
|
_END :
|
|
_END :
|
|
begin
|
|
begin
|
|
{$ifdef jvm}
|
|
{$ifdef jvm}
|