diff options
Diffstat (limited to 'classattributes/compiler')
-rw-r--r-- | classattributes/compiler/globals.pas | 2 | ||||
-rw-r--r-- | classattributes/compiler/globtype.pas | 6 | ||||
-rw-r--r-- | classattributes/compiler/pdecl.pas | 9 | ||||
-rw-r--r-- | classattributes/compiler/pdecobj.pas | 5 |
4 files changed, 14 insertions, 8 deletions
diff --git a/classattributes/compiler/globals.pas b/classattributes/compiler/globals.pas index c0fffb3e73..f8a0724746 100644 --- a/classattributes/compiler/globals.pas +++ b/classattributes/compiler/globals.pas @@ -52,7 +52,7 @@ interface [m_delphi,m_all,m_class,m_objpas,m_result,m_string_pchar, m_pointer_2_procedure,m_autoderef,m_tp_procvar,m_initfinal,m_default_ansistring, m_out,m_default_para,m_duplicate_names,m_hintdirective, - m_property,m_default_inline,m_except,m_advanced_records]; + m_property,m_default_inline,m_except,m_advanced_records,m_prefixed_attributes]; delphiunicodemodeswitches = delphimodeswitches + [m_systemcodepage,m_default_unicodestring]; fpcmodeswitches = [m_fpc,m_all,m_string_pchar,m_nested_comment,m_repeat_forward, diff --git a/classattributes/compiler/globtype.pas b/classattributes/compiler/globtype.pas index e562792b91..cd7e9f4426 100644 --- a/classattributes/compiler/globtype.pas +++ b/classattributes/compiler/globtype.pas @@ -336,8 +336,9 @@ interface m_final_fields, { allows declaring fields as "final", which means they must be initialised in the (class) constructor and are constant from then on (same as final fields in Java) } - m_default_unicodestring { makes the default string type in $h+ mode unicodestring rather than + m_default_unicodestring, { makes the default string type in $h+ mode unicodestring rather than ansistring; similarly, char becomes unicodechar rather than ansichar } + m_prefixed_attributes { enable attributes that are defined before the type they belong to } ); tmodeswitches = set of tmodeswitch; @@ -492,7 +493,8 @@ interface 'ISOUNARYMINUS', 'SYSTEMCODEPAGE', 'FINALFIELDS', - 'UNICODESTRINGS'); + 'UNICODESTRINGS', + 'PREFIXEDATTRIBUTES'); type diff --git a/classattributes/compiler/pdecl.pas b/classattributes/compiler/pdecl.pas index 7696bb068e..fc0067611e 100644 --- a/classattributes/compiler/pdecl.pas +++ b/classattributes/compiler/pdecl.pas @@ -498,10 +498,11 @@ implementation generictokenbuf:=nil; { class attribute definitions? } - while token=_LECKKLAMMER do - begin - parse_rttiattributes(current_rtticlassattributesdef); - end; + if m_prefixed_attributes in current_settings.modeswitches then + while token=_LECKKLAMMER do + begin + parse_rttiattributes(current_rtticlassattributesdef); + end; { fpc generic declaration? } isgeneric:=not(m_delphi in current_settings.modeswitches) and try_to_consume(_GENERIC); diff --git a/classattributes/compiler/pdecobj.pas b/classattributes/compiler/pdecobj.pas index 2268a3e5e0..f3be881722 100644 --- a/classattributes/compiler/pdecobj.pas +++ b/classattributes/compiler/pdecobj.pas @@ -1227,7 +1227,10 @@ implementation end; _LECKKLAMMER: begin - parse_rttiattributes(current_rttiattributesdef); + if m_prefixed_attributes in current_settings.modeswitches then + parse_rttiattributes(current_rttiattributesdef) + else + consume(_ID); end; _END : begin |