瀏覽代碼

compiler: use anonymous inherited in all cases where the next token <> _ID (bug #0018443)

git-svn-id: trunk@16741 -
paul 14 年之前
父節點
當前提交
8f7ada0db0
共有 3 個文件被更改,包括 34 次插入1 次删除
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/pexpr.pas
  3. 32 0
      tests/webtbs/tw18443.pp

+ 1 - 0
.gitattributes

@@ -10945,6 +10945,7 @@ tests/webtbs/tw1820.pp svneol=native#text/plain
 tests/webtbs/tw18222.pp svneol=native#text/pascal
 tests/webtbs/tw18222.pp svneol=native#text/pascal
 tests/webtbs/tw1825.pp svneol=native#text/plain
 tests/webtbs/tw1825.pp svneol=native#text/plain
 tests/webtbs/tw18266.pp svneol=native#text/plain
 tests/webtbs/tw18266.pp svneol=native#text/plain
+tests/webtbs/tw18443.pp svneol=native#text/pascal
 tests/webtbs/tw1850.pp svneol=native#text/plain
 tests/webtbs/tw1850.pp svneol=native#text/plain
 tests/webtbs/tw1851.pp svneol=native#text/plain
 tests/webtbs/tw1851.pp svneol=native#text/plain
 tests/webtbs/tw1856.pp svneol=native#text/plain
 tests/webtbs/tw1856.pp svneol=native#text/plain

+ 1 - 1
compiler/pexpr.pas

@@ -2383,7 +2383,7 @@ implementation
                       hclassdef:=hclassdef.childof;
                       hclassdef:=hclassdef.childof;
                     { if inherited; only then we need the method with
                     { if inherited; only then we need the method with
                       the same name }
                       the same name }
-                    if token in endtokens then
+                    if token <> _ID then
                      begin
                      begin
                        hs:=current_procinfo.procdef.procsym.name;
                        hs:=current_procinfo.procdef.procsym.name;
                        hsorg:=current_procinfo.procdef.procsym.realname;
                        hsorg:=current_procinfo.procdef.procsym.realname;

+ 32 - 0
tests/webtbs/tw18443.pp

@@ -0,0 +1,32 @@
+program tw18433;
+{$mode objfpc}
+type
+  TBase = class
+    function Print: String; virtual;
+  end;
+
+  TDesc1 = class(TBase)
+    function Print: String; override;
+  end;
+
+  TDesc2 = class(TBase)
+    function Print: String; override;
+  end;
+
+function TBase.Print: String;
+begin
+  Result := 'Base';
+end;
+
+function TDesc1.Print: String;
+begin
+  Result := inherited + '-Desc1';
+end;
+
+function TDesc2.Print: String;
+begin
+  Result := inherited Print + '-Desc2';
+end;
+
+begin
+end.