Explorar o código

* don't error out or generate invalid code for "with x do ;"
(Delphi/TP-compatible, mantis #15274)

git-svn-id: trunk@14370 -

Jonas Maebe %!s(int64=15) %!d(string=hai) anos
pai
achega
40f88809af
Modificáronse 3 ficheiros con 45 adicións e 1 borrados
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/pstatmnt.pas
  3. 43 0
      tests/webtbs/tw15274.pp

+ 1 - 0
.gitattributes

@@ -10110,6 +10110,7 @@ tests/webtbs/tw1501.pp svneol=native#text/plain
 tests/webtbs/tw15088.pp svneol=native#text/plain
 tests/webtbs/tw15169.pp svneol=native#text/plain
 tests/webtbs/tw15207.pp svneol=native#text/plain
+tests/webtbs/tw15274.pp svneol=native#text/plain
 tests/webtbs/tw1532.pp svneol=native#text/plain
 tests/webtbs/tw1539.pp svneol=native#text/plain
 tests/webtbs/tw1567.pp svneol=native#text/plain

+ 1 - 1
compiler/pstatmnt.pas

@@ -694,7 +694,7 @@ implementation
                 if token<>_SEMICOLON then
                   p:=statement
                 else
-                  p:=cerrornode.create;
+                  p:=cnothingnode.create;
               end;
 
             { remove symtables in reverse order from the stack }

+ 43 - 0
tests/webtbs/tw15274.pp

@@ -0,0 +1,43 @@
+{ %norun }
+
+{$mode objfpc}{$H+}
+
+uses
+  Classes, SysUtils;
+
+type
+
+  { TItem }
+
+  TItem = class
+  public
+    procedure DoSomething;
+  end;
+
+  { TConainer }
+
+  TContainer = class
+  public
+    constructor Create;
+  end;
+
+{ TConainer }
+
+constructor TContainer.Create;
+begin
+  inherited Create;
+  with TItem.Create do
+   ;
+//   begin end;
+end;
+
+{ TItem }
+
+procedure TItem.DoSomething;
+begin
+end;
+
+begin
+end.
+
+