瀏覽代碼

compiler: allow TFoo.TBar types for object methods (bug #0018123)

git-svn-id: trunk@16493 -
paul 14 年之前
父節點
當前提交
ab4a5c74c1
共有 4 個文件被更改,包括 25 次插入2 次删除
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/psub.pas
  3. 1 1
      compiler/ptype.pas
  4. 22 0
      tests/webtbs/tw18123.pp

+ 1 - 0
.gitattributes

@@ -10776,6 +10776,7 @@ tests/webtbs/tw18075.pp svneol=native#text/pascal
 tests/webtbs/tw18082.pp svneol=native#text/plain
 tests/webtbs/tw18085.pp svneol=native#text/pascal
 tests/webtbs/tw18086.pp svneol=native#text/pascal
+tests/webtbs/tw18123.pp svneol=native#text/pascal
 tests/webtbs/tw18127.pp svneol=native#text/pascal
 tests/webtbs/tw1820.pp svneol=native#text/plain
 tests/webtbs/tw1825.pp svneol=native#text/plain

+ 1 - 1
compiler/psub.pas

@@ -1996,7 +1996,7 @@ implementation
           symtablestack.push(hmodule.localsymtable);
 
         { procedure definitions for classes or objects }
-        if is_class(specobj) or is_object(specobj) then
+        if is_class_or_object(specobj) then
           begin
             for i:=0 to specobj.symtable.DefList.Count-1 do
               begin

+ 1 - 1
compiler/ptype.pas

@@ -489,7 +489,7 @@ implementation
                                 consume(_POINT);
                                 consume(_ID);
                              end
-                            else if is_class(def) then
+                            else if is_class_or_object(def) then
                               begin
                                 symtablestack.push(tobjectdef(def).symtable);
                                 consume(_POINT);

+ 22 - 0
tests/webtbs/tw18123.pp

@@ -0,0 +1,22 @@
+{ %norun% }
+program tw18123;
+
+{$mode objfpc}{$H+}
+
+type
+  TFoo2 = object
+  type
+    TFoo3 = object
+    end;
+    TFoo4 = object
+      function GetFoo3: TFoo3;
+    end;
+  end;
+
+function TFoo2.TFoo4.GetFoo3: TFoo2.TFoo3; // was error: Syntax error, ";" expected but "." found
+begin
+end;
+
+begin
+end.
+