From a86857dd157726189b6143b688bc2ad5d5cc0dca Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 5 Apr 2019 10:51:11 +0000 Subject: [PATCH] pastojs: fixed TExt(TExt.new) --- compiler/packages/pastojs/src/fppas2js.pp | 2 +- compiler/packages/pastojs/tests/tcmodules.pas | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/packages/pastojs/src/fppas2js.pp b/compiler/packages/pastojs/src/fppas2js.pp index 9ca5278..bfc39c5 100644 --- a/compiler/packages/pastojs/src/fppas2js.pp +++ b/compiler/packages/pastojs/src/fppas2js.pp @@ -7556,7 +7556,7 @@ begin else if aResolver.IsExternalClassConstructor(RightRefDecl) then begin // e.g. mod.ExtClass.new; - if El.Parent is TParamsExpr then + if (El.Parent is TParamsExpr) and (TParamsExpr(El.Parent).Value=El) then // Note: ExtClass.new() is handled in ConvertFuncParams RaiseNotSupported(El,AContext,20190116135818); Result:=ConvertExternalConstructor(El.left,RightRef,nil,AContext); diff --git a/compiler/packages/pastojs/tests/tcmodules.pas b/compiler/packages/pastojs/tests/tcmodules.pas index f4f958d..1073451 100644 --- a/compiler/packages/pastojs/tests/tcmodules.pas +++ b/compiler/packages/pastojs/tests/tcmodules.pas @@ -15757,6 +15757,7 @@ begin Add(' A: texta;'); Add('begin'); Add(' a:=texta.new;'); + Add(' a:=texta(texta.new);'); Add(' a:=texta.new();'); Add(' a:=texta.new(1);'); Add(' with texta do begin'); @@ -15775,6 +15776,7 @@ begin LinesToStr([ // $mod.$main '$mod.A = new ExtA();', '$mod.A = new ExtA();', + '$mod.A = new ExtA();', '$mod.A = new ExtA(1,2);', '$mod.A = new ExtA();', '$mod.A = new ExtA();',