瀏覽代碼

compiler:
- add mode switch extendedrecords to allow/disallow extended records syntax, add this mode switch to delphi mode by default
- disable/enable extended records parsing based on extendedreocrds mode switch

git-svn-id: branches/paul/extended_records@16561 -

paul 14 年之前
父節點
當前提交
726ea27bc0
共有 4 個文件被更改,包括 14 次插入5 次删除
  1. 1 1
      compiler/globals.pas
  2. 4 2
      compiler/globtype.pas
  3. 2 1
      compiler/pdecvar.pas
  4. 7 1
      compiler/ptype.pas

+ 1 - 1
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_add_pointer,
-          m_property,m_default_inline,m_except];
+          m_property,m_default_inline,m_except,m_extended_records];
        fpcmodeswitches =
          [m_fpc,m_all,m_string_pchar,m_nested_comment,m_repeat_forward,
           m_cvar_support,m_initfinal,m_add_pointer,m_hintdirective,

+ 4 - 2
compiler/globtype.pas

@@ -273,7 +273,8 @@ interface
          m_objectivec1,         { support interfacing with Objective-C (1.0) }
          m_objectivec2,         { support interfacing with Objective-C (2.0) }
          m_nested_procvars,     { support nested procedural variables }
-         m_non_local_goto       { support non local gotos (like iso pascal) }
+         m_non_local_goto,      { support non local gotos (like iso pascal) }
+         m_extended_records     { extended record syntax with visibility sections, methods and properties }
        );
        tmodeswitches = set of tmodeswitch;
 
@@ -393,7 +394,8 @@ interface
          'OBJECTIVEC1',
          'OBJECTIVEC2',
          'NESTEDPROCVARS',
-         'NONLOCALGOTO');
+         'NONLOCALGOTO',
+         'EXTENDEDRECORDS');
 
 
      type

+ 2 - 1
compiler/pdecvar.pas

@@ -1411,7 +1411,8 @@ implementation
          sc:=TFPObjectList.create(false);
          recstlist:=TFPObjectList.create(false);;
          while (token=_ID) and
-            not(([vd_object,vd_record]*options<>[]) and
+            not(((vd_object in options) or
+                 ((vd_record in options) and (m_extended_records in current_settings.modeswitches))) and
                 (idtoken in [_PUBLIC,_PRIVATE,_PUBLISHED,_PROTECTED,_STRICT])) do
            begin
              visibility:=symtablestack.top.currentvisibility;

+ 7 - 1
compiler/ptype.pas

@@ -832,7 +832,13 @@ implementation
          symtablestack.push(recst);
          { parse record }
          consume(_RECORD);
-         parse_record_members;
+         if m_extended_records in current_settings.modeswitches then
+           parse_record_members
+         else
+           begin
+             read_record_fields([vd_record]);
+             consume(_END);
+           end;
          { make the record size aligned }
          recst.addalignmentpadding;
          { restore symtable stack }