Преглед изворни кода

* also parse postfix operators after parsing a _STRING token (required for class functions on type helpers for String)
+ added tests

git-svn-id: trunk@39399 -

svenbarth пре 7 година
родитељ
комит
441fc2fab6
5 измењених фајлова са 58 додато и 1 уклоњено
  1. 3 0
      .gitattributes
  2. 9 1
      compiler/pexpr.pas
  3. 15 0
      tests/test/tthlp26a.pp
  4. 15 0
      tests/test/tthlp26b.pp
  5. 16 0
      tests/test/tthlp26c.pp

+ 3 - 0
.gitattributes

@@ -13759,6 +13759,9 @@ tests/test/tthlp22.pp svneol=native#text/pascal
 tests/test/tthlp23.pp svneol=native#text/pascal
 tests/test/tthlp24.pp svneol=native#text/pascal
 tests/test/tthlp25.pp svneol=native#text/pascal
+tests/test/tthlp26a.pp -text svneol=native#text/pascal
+tests/test/tthlp26b.pp -text svneol=native#text/pascal
+tests/test/tthlp26c.pp -text svneol=native#text/pascal
 tests/test/tthlp3.pp svneol=native#text/pascal
 tests/test/tthlp4.pp svneol=native#text/pascal
 tests/test/tthlp5.pp svneol=native#text/pascal

+ 9 - 1
compiler/pexpr.pas

@@ -3698,7 +3698,15 @@ implementation
                     postfixoperators(p1,again,getaddr);
                   end
                  else
-                  p1:=ctypenode.create(hdef);
+                   begin
+                     p1:=ctypenode.create(hdef);
+                     if token=_POINT then
+                       begin
+                         again:=true;
+                         { handle type helpers here }
+                         postfixoperators(p1,again,getaddr);
+                       end;
+                   end;
                end;
 
              _FILE :

+ 15 - 0
tests/test/tthlp26a.pp

@@ -0,0 +1,15 @@
+{ test that the correct type helper is used for String = ShortString }
+
+program tthlp26a;
+
+{$mode objfpc}
+{$modeswitch typehelpers}
+
+uses
+  uthlp;
+
+begin
+  if String.TestClass <> 1 then
+    Halt(1);
+  Writeln('ok');
+end.

+ 15 - 0
tests/test/tthlp26b.pp

@@ -0,0 +1,15 @@
+{ test that the correct type helper is used for String = AnsiString }
+
+program tthlp26b;
+
+{$mode objfpc}{$H+}
+{$modeswitch typehelpers}
+
+uses
+  uthlp;
+
+begin
+  if String.TestClass <> 2 then
+    Halt(1);
+  Writeln('ok');
+end.

+ 16 - 0
tests/test/tthlp26c.pp

@@ -0,0 +1,16 @@
+{ test that the correct type helper is used for String = UnicodeString }
+
+program tthlp26c;
+
+{$mode objfpc}{$H+}
+{$modeswitch unicodestrings}
+{$modeswitch typehelpers}
+
+uses
+  uthlp;
+
+begin
+  if String.TestClass <> 4 then
+    Halt(1);
+  Writeln('ok');
+end.