Browse Source

pgentype.pas:
+ new constant inline_specialization_block_types to easily keep track of block types in which inline specialization is allowed
pexpr.pas:
* use new inline_specializatio_block_types instead of a inline constant set

git-svn-id: trunk@32388 -

svenbarth 9 năm trước cách đây
mục cha
commit
89d37c1e69
2 tập tin đã thay đổi với 8 bổ sung7 xóa
  1. 4 4
      compiler/pexpr.pas
  2. 4 3
      compiler/pgentype.pas

+ 4 - 4
compiler/pexpr.pas

@@ -1497,7 +1497,7 @@ implementation
                  result:=ctypenode.create(hdef);
                  ttypenode(result).typesym:=sym;
                  if not (m_delphi in current_settings.modeswitches) and
-                     (block_type in [bt_type,bt_var_type,bt_const_type]) and
+                     (block_type in inline_specialization_block_types) and
                      (token=_ID) and
                      (idtoken=_SPECIALIZE) then
                    begin
@@ -1538,7 +1538,7 @@ implementation
                 result:=ctypenode.create(hdef);
                 ttypenode(result).typesym:=sym;
                 if not (m_delphi in current_settings.modeswitches) and
-                    (block_type in [bt_type,bt_var_type,bt_const_type]) and
+                    (block_type in inline_specialization_block_types) and
                     (token=_ID) and
                     (idtoken=_SPECIALIZE) then
                   begin
@@ -2129,7 +2129,7 @@ implementation
           _POINT :
              begin
                consume(_POINT);
-               allowspecialize:=not (m_delphi in current_settings.modeswitches) and (block_type in [bt_type,bt_var_type,bt_const_type]);
+               allowspecialize:=not (m_delphi in current_settings.modeswitches) and (block_type in inline_specialization_block_types);
                if allowspecialize and (token=_ID) and (idtoken=_SPECIALIZE) then
                  begin
                    //consume(_ID);
@@ -2723,7 +2723,7 @@ implementation
 
            allowspecialize:=not (m_delphi in current_settings.modeswitches) and
                             not (ef_had_specialize in flags) and
-                            (block_type in [bt_type,bt_var_type,bt_const_type]);
+                            (block_type in inline_specialization_block_types);
            if allowspecialize and (token=_ID) and (idtoken=_SPECIALIZE) then
              begin
                consume(_ID);

+ 4 - 3
compiler/pgentype.pas

@@ -27,8 +27,12 @@ interface
 
 uses
   cclasses,
+  globtype,
   symtype,symbase;
 
+const
+  inline_specialization_block_types = [bt_type,bt_var_type,bt_const_type];
+
 type
   tspecializationstate = record
     oldsymtablestack   : tsymtablestack;
@@ -52,9 +56,6 @@ type
 
 implementation
 
-uses
-  globtype;
-
 constructor tspecializationcontext.create;
 begin
   genericdeflist:=tfpobjectlist.create(false);