浏览代码

+ add a new modeswitch ArrayOperators which is set by default in Delphi modes that enables the internal array operators (currently only "+")

git-svn-id: trunk@39259 -
svenbarth 7 年之前
父节点
当前提交
97acf24290
共有 5 个文件被更改,包括 12 次插入7 次删除
  1. 2 2
      .gitattributes
  2. 2 1
      compiler/globals.pas
  3. 4 2
      compiler/globtype.pas
  4. 3 1
      compiler/htypechk.pas
  5. 1 1
      compiler/nadd.pas

+ 2 - 2
.gitattributes

@@ -185,9 +185,9 @@ compiler/fppu.pas svneol=native#text/plain
 compiler/gendef.pas svneol=native#text/plain
 compiler/generic/cpuinfo.pas svneol=native#text/plain
 compiler/generic/symcpu.pas svneol=native#text/plain
-compiler/globals.pas svneol=native#text/plain
+compiler/globals.pas -text svneol=native#text/plain
 compiler/globstat.pas svneol=native#text/pascal
-compiler/globtype.pas svneol=native#text/plain
+compiler/globtype.pas -text svneol=native#text/plain
 compiler/hlcg2ll.pas svneol=native#text/plain
 compiler/hlcgobj.pas svneol=native#text/plain
 compiler/html/i386/readme.txt svneol=native#text/plain

+ 2 - 1
compiler/globals.pas

@@ -54,7 +54,8 @@ interface
          [m_delphi,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_array_operators];
        delphiunicodemodeswitches = delphimodeswitches + [m_systemcodepage,m_default_unicodestring];
        fpcmodeswitches =
          [m_fpc,m_string_pchar,m_nested_comment,m_repeat_forward,

+ 4 - 2
compiler/globtype.pas

@@ -438,7 +438,8 @@ interface
          m_blocks,              { support for http://en.wikipedia.org/wiki/Blocks_(C_language_extension) }
          m_isolike_io,          { I/O as it required by an ISO compatible compiler }
          m_isolike_program_para, { program parameters as it required by an ISO compatible compiler }
-         m_isolike_mod          { mod operation as it is required by an iso compatible compiler }
+         m_isolike_mod,         { mod operation as it is required by an iso compatible compiler }
+         m_array_operators      { use Delphi compatible array operators instead of custom ones ("+") }
        );
        tmodeswitches = set of tmodeswitch;
 
@@ -626,7 +627,8 @@ interface
          'CBLOCKS',
          'ISOIO',
          'ISOPROGRAMPARAS',
-         'ISOMOD'
+         'ISOMOD',
+         'ARRAYOPERATORS'
          );
 
 

+ 3 - 1
compiler/htypechk.pas

@@ -515,7 +515,9 @@ implementation
                     end;
 
                  { <dyn. array> + <dyn. array> is handled by the compiler }
-                 if (treetyp=addn) and (is_dynamic_array(ld) or is_dynamic_array(rd)) then
+                 if (m_array_operators in current_settings.modeswitches) and
+                     (treetyp=addn) and
+                     (is_dynamic_array(ld) or is_dynamic_array(rd)) then
                     begin
                       allowed:=false;
                       exit;

+ 1 - 1
compiler/nadd.pas

@@ -3436,7 +3436,7 @@ implementation
          { Can we optimize multiple dyn. array additions into a single call?
            This need to be done on a complete tree to detect the multiple
            add nodes and is therefor done before the subtrees are processed }
-         if canbemultidynarrayadd(self) then
+         if (m_array_operators in current_settings.modeswitches) and canbemultidynarrayadd(self) then
            begin
              result:=genmultidynarrayadd(self);
              exit;