Переглянути джерело

* allow local procsym in delphi mode

git-svn-id: trunk@8148 -
peter 18 роки тому
батько
коміт
703b8855cc
3 змінених файлів з 30 додано та 9 видалено
  1. 1 0
      .gitattributes
  2. 6 9
      compiler/symtable.pas
  3. 23 0
      tests/webtbs/tw9176a.pp

+ 1 - 0
.gitattributes

@@ -8349,6 +8349,7 @@ tests/webtbs/tw9161.pp svneol=native#text/plain
 tests/webtbs/tw9162.pp svneol=native#text/plain
 tests/webtbs/tw9167.pp svneol=native#text/plain
 tests/webtbs/tw9174.pp svneol=native#text/plain
+tests/webtbs/tw9176a.pp -text
 tests/webtbs/tw9179.pp svneol=native#text/plain
 tests/webtbs/tw9187.pp svneol=native#text/plain
 tests/webtbs/tw9190.pp svneol=native#text/plain

+ 6 - 9
compiler/symtable.pas

@@ -1038,9 +1038,10 @@ implementation
          if not assigned(defowner) then
            internalerror(200602061);
 
-         { check for duplicate field, parameter or local names
-           also in inherited classes }
-         if (sym.typ in [fieldvarsym,paravarsym,localvarsym]) and
+         { procsym and propertysym have special code
+           to override values in inherited classes. For other
+           symbols check for duplicates }
+         if not(sym.typ in [procsym,propertysym]) and
             (
              not(m_delphi in current_settings.modeswitches) or
              is_object(tdef(defowner))
@@ -1057,8 +1058,7 @@ implementation
            end
          else
            begin
-             if not(m_duplicate_names in current_settings.modeswitches) or
-                not(sym.typ in [paravarsym,localvarsym]) then
+             if not(m_duplicate_names in current_settings.modeswitches) then
                result:=inherited checkduplicate(hashedid,sym);
            end;
       end;
@@ -1168,10 +1168,7 @@ implementation
         if not is_funcret_sym(sym) and
            (defowner.typ=procdef) and
            assigned(tprocdef(defowner)._class) and
-           (tprocdef(defowner).owner.defowner=tprocdef(defowner)._class) and
-           { delphi allows local typed consts. having the same name as class members, probably
-             a delphi bug, but some delphi code depends on it }
-           not((m_duplicate_names in current_settings.modeswitches) and (sym.typ=staticvarsym)) then
+           (tprocdef(defowner).owner.defowner=tprocdef(defowner)._class) then
           result:=tprocdef(defowner)._class.symtable.checkduplicate(hashedid,sym);
       end;
 

+ 23 - 0
tests/webtbs/tw9176a.pp

@@ -0,0 +1,23 @@
+{$mode delphi}
+
+type TBla=class
+     bla : integer;
+      procedure Bla;
+      procedure BlaBla;
+     end;
+
+procedure TBla.Bla;
+begin
+end;
+
+procedure TBla.BlaBla;
+ procedure Bla;
+ begin
+ end;
+begin
+ Bla;
+end;
+
+begin
+end.
+