瀏覽代碼

* fixed support for forward-declared objcprotocols
+ test (also for warning about missing constructor)

git-svn-id: branches/objc@13633 -

Jonas Maebe 16 年之前
父節點
當前提交
970fc43aa5
共有 3 個文件被更改,包括 24 次插入1 次删除
  1. 1 0
      .gitattributes
  2. 2 1
      compiler/pdecl.pas
  3. 21 0
      tests/test/tobjc14.pp

+ 1 - 0
.gitattributes

@@ -8221,6 +8221,7 @@ tests/test/tobjc10.pp svneol=native#text/plain
 tests/test/tobjc11.pp svneol=native#text/plain
 tests/test/tobjc12.pp svneol=native#text/plain
 tests/test/tobjc13.pp svneol=native#text/plain
+tests/test/tobjc14.pp svneol=native#text/plain
 tests/test/tobjc2.pp svneol=native#text/plain
 tests/test/tobjc3.pp svneol=native#text/plain
 tests/test/tobjc4.pp svneol=native#text/plain

+ 2 - 1
compiler/pdecl.pas

@@ -389,7 +389,8 @@ implementation
                  if ((token=_CLASS) or
                      (token=_INTERFACE) or
                      (token=_DISPINTERFACE) or
-                     (token=_OBJCCLASS)) and
+                     (token=_OBJCCLASS) or
+                     (token=_OBJCPROTOCOL)) and
                     (assigned(ttypesym(sym).typedef)) and
                     is_class_or_interface_or_dispinterface_or_objc(ttypesym(sym).typedef) and
                     (oo_is_forward in tobjectdef(ttypesym(sym).typedef).objectoptions) then

+ 21 - 0
tests/test/tobjc14.pp

@@ -0,0 +1,21 @@
+{ %OPT=-Sew -vw }
+{ %norun }
+
+{$mode objfpc}
+{$modeswitch objectivec1}
+
+{ test forward-declared objcprotocol }
+{ make sure no warning is given about the absense of any constructors }
+
+type
+  ta = objcprotocol;
+
+  tb = objcclass
+    a: ta;
+  end; external name 'NSObject';
+
+  ta = objcprotocol
+  end; external name 'NSObject';
+
+begin
+end.