Explorar o código

* support objc.id.<anyobjcmethod> in Delphi mode (mantis #15607)

git-svn-id: trunk@14822 -
Jonas Maebe %!s(int64=15) %!d(string=hai) anos
pai
achega
2be600afff
Modificáronse 3 ficheiros con 14 adicións e 1 borrados
  1. 1 0
      .gitattributes
  2. 4 1
      compiler/pexpr.pas
  3. 9 0
      tests/webtbs/tw15607.pp

+ 1 - 0
.gitattributes

@@ -10240,6 +10240,7 @@ tests/webtbs/tw15467.pp svneol=native#text/pascal
 tests/webtbs/tw15500.pp svneol=native#text/plain
 tests/webtbs/tw15504.pp svneol=native#text/plain
 tests/webtbs/tw15530.pp svneol=native#text/pascal
+tests/webtbs/tw15607.pp svneol=native#text/plain
 tests/webtbs/tw1567.pp svneol=native#text/plain
 tests/webtbs/tw1573.pp svneol=native#text/plain
 tests/webtbs/tw1592.pp svneol=native#text/plain

+ 4 - 1
compiler/pexpr.pas

@@ -2020,7 +2020,10 @@ implementation
                   begin
                     consume(_POINT);
                     if (p1.resultdef.typ=pointerdef) and
-                       (m_autoderef in current_settings.modeswitches) then
+                       (m_autoderef in current_settings.modeswitches) and
+                       { don't auto-deref objc.id, because then the code
+                         below for supporting id.anyobjcmethod isn't triggered }
+                       (p1.resultdef<>objc_idtype) then
                       begin
                         p1:=cderefnode.create(p1);
                         do_typecheckpass(p1);

+ 9 - 0
tests/webtbs/tw15607.pp

@@ -0,0 +1,9 @@
+{ %norun }
+
+{$mode delphi}{$modeswitch objectivec1}
+
+var
+  o: id;
+begin
+  o.description;
+end.