From 22864b47e45fa6be6cc7f5c7aae41f4cfc1dc65b Mon Sep 17 00:00:00 2001 From: Mattias Gaertner Date: Sun, 10 Jan 2021 22:56:39 +0000 Subject: [PATCH] pastojs: record complex only for records with class vars git-svn-id: trunk@48131 - --- packages/pastojs/src/fppas2js.pp | 2 +- packages/pastojs/tests/tcmodules.pas | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/pastojs/src/fppas2js.pp b/packages/pastojs/src/fppas2js.pp index fa6f7901b2..49a62c1f37 100644 --- a/packages/pastojs/src/fppas2js.pp +++ b/packages/pastojs/src/fppas2js.pp @@ -26464,7 +26464,7 @@ begin if (C=TPasConstructor) or ((aResolver<>nil) and aResolver.IsClassMethod(P) and not aResolver.MethodIsStatic(TPasProcedure(P))) then - IsComplex:=true; // needs $record + ; //IsComplex:=true; // needs $record end; end else if C=TPasAttributes then diff --git a/packages/pastojs/tests/tcmodules.pas b/packages/pastojs/tests/tcmodules.pas index 84165e2168..c46a2aafda 100644 --- a/packages/pastojs/tests/tcmodules.pas +++ b/packages/pastojs/tests/tcmodules.pas @@ -12339,12 +12339,20 @@ begin 'type', ' TPoint = record', ' x,y: longint;', + ' class procedure Run(w: longint = 13); static;', ' constructor Create(ax: longint; ay: longint = -1);', ' end;', + 'class procedure tpoint.run(w: longint);', + 'begin', + ' run;', + ' run();', + 'end;', 'constructor tpoint.create(ax,ay: longint);', 'begin', ' x:=ax;', ' self.y:=ay;', + ' run;', + ' run(ax);', 'end;', 'var r: TPoint;', 'begin', @@ -12367,12 +12375,18 @@ begin ' this.y = s.y;', ' return this;', ' };', + ' this.Run = function (w) {', + ' $mod.TPoint.Run(13);', + ' $mod.TPoint.Run(13);', + ' };', ' this.Create = function (ax, ay) {', ' this.x = ax;', ' this.y = ay;', + ' this.Run(13);', + ' this.Run(ax);', ' return this;', ' };', - '}, true);', + '});', 'this.r = this.TPoint.$new();', '']), LinesToStr([ // $mod.$main @@ -23288,7 +23302,7 @@ begin ' $mod.THelper.$new("NewHlp", [3]);', ' return this;', ' };', - '}, true);', + '});', 'rtl.createHelper(this, "THelper", null, function () {', ' this.NewHlp = function (w) {', ' this.Create(2);',