Ver código fonte

* add methods of objcprotocols to the list of visible "helper" methods when
loading them from ppu (like was already done when they were initially
compiler), so they can be called via the "id" type even if no classes are
in scope that implement them

git-svn-id: trunk@29686 -

Jonas Maebe 10 anos atrás
pai
commit
071282b286
4 arquivos alterados com 28 adições e 1 exclusões
  1. 2 0
      .gitattributes
  2. 1 1
      compiler/symdef.pas
  3. 13 0
      tests/test/tobjc42.pp
  4. 12 0
      tests/test/uobjc42.pp

+ 2 - 0
.gitattributes

@@ -11972,6 +11972,7 @@ tests/test/tobjc39.pp svneol=native#text/plain
 tests/test/tobjc4.pp svneol=native#text/plain
 tests/test/tobjc40.pp svneol=native#text/plain
 tests/test/tobjc41.pp svneol=native#text/plain
+tests/test/tobjc42.pp svneol=native#text/plain
 tests/test/tobjc4a.pp svneol=native#text/plain
 tests/test/tobjc5.pp svneol=native#text/plain
 tests/test/tobjc5a.pp svneol=native#text/plain
@@ -12655,6 +12656,7 @@ tests/test/uobjc35f.pp svneol=native#text/plain
 tests/test/uobjc35g.pp svneol=native#text/plain
 tests/test/uobjc39.pp svneol=native#text/plain
 tests/test/uobjc41.pp svneol=native#text/plain
+tests/test/uobjc42.pp svneol=native#text/plain
 tests/test/uobjc7.pp svneol=native#text/plain
 tests/test/uobjcl1.pp svneol=native#text/plain
 tests/test/uprec6.pp svneol=native#text/plain

+ 1 - 1
compiler/symdef.pas

@@ -6313,7 +6313,7 @@ implementation
          inherited derefimpl;
          { the procdefs are not owned by the class helper procsyms, so they
            are not stored/restored either -> re-add them here }
-         if (objecttype=odt_objcclass) or
+         if (objecttype in [odt_objcclass,odt_objcprotocol]) or
             (oo_is_classhelper in objectoptions) then
            symtable.DefList.ForEachCall(@create_class_helper_for_procdef,nil);
       end;

+ 13 - 0
tests/test/tobjc42.pp

@@ -0,0 +1,13 @@
+{ %target=darwin }
+{ %recompile }
+{ %norun }
+
+{$modeswitch objectivec2}
+
+uses uobjc42;
+
+var
+  i: id;
+begin
+  i.mytest;
+end.

+ 12 - 0
tests/test/uobjc42.pp

@@ -0,0 +1,12 @@
+{$modeswitch objectivec2}
+unit uobjc42;
+
+interface
+type
+  tinf = objcprotocol
+    procedure mytest; message 'mytest';
+  end;
+
+implementation
+
+end.