Browse Source

* quote the mangled name of ObjC methods, because the +/- otherwise
confuse the assembler (patch by Dmitry Boyarintsev, from mantis
#14508)
* use objextname and not objrealname in the method name (extname is
the class/protocol/category name as it appears/will appear to the
ObjC runtime)

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

Jonas Maebe 16 years ago
parent
commit
ac1b340755
1 changed files with 8 additions and 5 deletions
  1. 8 5
      compiler/symdef.pas

+ 8 - 5
compiler/symdef.pas

@@ -3532,15 +3532,18 @@ implementation
           internalerror(2009030901);
           internalerror(2009030901);
         { we may very well need longer strings to handle these... }
         { we may very well need longer strings to handle these... }
         if ((255-length(tobjectdef(procsym.owner.defowner).objextname^)
         if ((255-length(tobjectdef(procsym.owner.defowner).objextname^)
-             -length('+[ ]')-length(messageinf.str^)) < 0) then
+             -length('+"[ ]"')-length(messageinf.str^)) < 0) then
           Message1(parser_e_objc_message_name_too_long,messageinf.str^);
           Message1(parser_e_objc_message_name_too_long,messageinf.str^);
         if not(po_classmethod in procoptions) then
         if not(po_classmethod in procoptions) then
-          result:='-['
+          result:='"-['
         else
         else
-          result:='+[';
+          result:='"+[';
+        { quotes are necessary because the +/- otherwise confuse the assembler
+          into expecting a number
+        }
         result:=
         result:=
-          result+tobjectdef(procsym.owner.defowner).objrealname^+' '+
-          messageinf.str^+']';
+          result+tobjectdef(procsym.owner.defowner).objextname^+' '+
+          messageinf.str^+']"';
       end;
       end;