diff options
author | mattias <mattias@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2020-09-23 14:31:17 +0000 |
---|---|---|
committer | mattias <mattias@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2020-09-23 14:31:17 +0000 |
commit | 29d27e13237e8b8fdf2cee276a9b99defe2e114f (patch) | |
tree | cc3d79eb541eb71d140e9ce353b68fa9aef9f3be /packages/pastojs/tests | |
parent | dc37889a2824a162dfb6793844cb60225b46936a (diff) | |
download | fpc-29d27e13237e8b8fdf2cee276a9b99defe2e114f.tar.gz |
pastojs: optimization ShortRefGlobals
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@46927 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/pastojs/tests')
-rw-r--r-- | packages/pastojs/tests/tcgenerics.pas | 136 | ||||
-rw-r--r-- | packages/pastojs/tests/tcmodules.pas | 1400 | ||||
-rw-r--r-- | packages/pastojs/tests/tcoptimizations.pas | 124 | ||||
-rw-r--r-- | packages/pastojs/tests/testpas2js.lpi | 1 |
4 files changed, 885 insertions, 776 deletions
diff --git a/packages/pastojs/tests/tcgenerics.pas b/packages/pastojs/tests/tcgenerics.pas index 3beb9a68c9..e0307d0621 100644 --- a/packages/pastojs/tests/tcgenerics.pas +++ b/packages/pastojs/tests/tcgenerics.pas @@ -102,7 +102,7 @@ begin ConvertProgram; CheckSource('TestGen_RecordEmpty', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRecA$G1", function () {', + 'rtl.recNewT(this, "TRecA$G1", function () {', ' this.$eq = function (b) {', ' return true;', ' };', @@ -110,8 +110,8 @@ begin ' return this;', ' };', '});', - 'this.a = $mod.TRecA$G1.$new();', - 'this.b = $mod.TRecA$G1.$new();', + 'this.a = this.TRecA$G1.$new();', + 'this.b = this.TRecA$G1.$new();', '']), LinesToStr([ // $mod.$main 'if ($mod.a.$eq($mod.b)) ;' @@ -144,7 +144,7 @@ begin ConvertProgram; CheckSource('TestGen_Record_ClassProc', LinesToStr([ // statements - 'rtl.recNewT($mod, "TPoint$G1", function () {', + 'rtl.recNewT(this, "TPoint$G1", function () {', ' this.x = 0;', ' this.$eq = function (b) {', ' return true;', @@ -159,7 +159,7 @@ begin ' $mod.TPoint$G1.Fly();', ' };', '}, true);', - 'this.p = $mod.TPoint$G1.$new();', + 'this.p = this.TPoint$G1.$new();', '']), LinesToStr([ // $mod.$main '$mod.TPoint$G1.x = $mod.p.x + 10;', @@ -187,7 +187,7 @@ begin ConvertProgram; CheckSource('TestGen_Record_ClassVarRecord_Program', LinesToStr([ // statements - 'rtl.recNewT($mod, "TBird", function () {', + 'rtl.recNewT(this, "TBird", function () {', ' this.b = 0;', ' this.$eq = function (b) {', ' return this.b === b.b;', @@ -197,7 +197,7 @@ begin ' return this;', ' };', '});', - 'rtl.recNewT($mod, "TAnt$G1", function () {', + 'rtl.recNewT(this, "TAnt$G1", function () {', ' this.x = $mod.TBird.$new();', ' this.$eq = function (b) {', ' return true;', @@ -206,7 +206,7 @@ begin ' return this;', ' };', '}, true);', - 'this.f = $mod.TAnt$G1.$new();', + 'this.f = this.TAnt$G1.$new();', '']), LinesToStr([ // $mod.$main '$mod.f.x.b = $mod.f.x.b + 10;', @@ -244,7 +244,7 @@ begin 'rtl.module("UnitA", ["system"], function () {', ' var $mod = this;', ' var $impl = $mod.$impl;', - ' rtl.recNewT($mod, "TAnt$G1", function () {', + ' rtl.recNewT(this, "TAnt$G1", function () {', ' this.$initSpec = function () {', ' this.x = $impl.TBird.$new();', ' this.a = rtl.arraySetLength(null, $impl.TBird, 2);', @@ -307,7 +307,7 @@ begin CheckSource('TestGen_Record_RTTI_UnitImpl', LinesToStr([ // statements 'var $impl = $mod.$impl;', - 'rtl.recNewT($mod, "TAnt$G1", function () {', + 'rtl.recNewT(this, "TAnt$G1", function () {', ' var $r = $mod.$rtti.$Record("TAnt<Test1.TBird>", {});', ' this.$initSpec = function () {', ' this.x = $impl.TBird.$new();', @@ -356,13 +356,13 @@ begin ConvertProgram; CheckSource('TestGen_ClassEmpty', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird$G1", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird$G1", this.TObject, function () {', '});', 'this.a = null;', 'this.b = null;', @@ -390,13 +390,13 @@ begin ConvertProgram; CheckSource('TestGen_Class_EmptyMethod', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird$G1", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird$G1", this.TObject, function () {', ' this.Fly = function (w) {', ' var Result = 0;', ' return Result;', @@ -449,13 +449,13 @@ begin ConvertProgram; CheckSource('TestGen_Class_TList', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TList$G1", $mod.TObject, function () {', + 'rtl.createClass(this, "TList$G1", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.FItems = [];', @@ -518,19 +518,19 @@ begin ConvertProgram; CheckSource('TestGen_Class_TCustomList', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TCustomList$G2", $mod.TObject, function () {', + 'rtl.createClass(this, "TCustomList$G2", this.TObject, function () {', ' this.PrepareAddingItem = function () {', ' var Result = 0;', ' return Result;', ' };', '});', - 'rtl.createClass($mod, "TList$G1", $mod.TCustomList$G2, function () {', + 'rtl.createClass(this, "TList$G1", this.TCustomList$G2, function () {', ' this.Add = function () {', ' var Result = 0;', ' Result = this.PrepareAddingItem();', @@ -559,15 +559,15 @@ begin ConvertProgram; CheckSource('TestGen_ClassAncestor', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird$G2", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird$G2", this.TObject, function () {', '});', - 'rtl.createClass($mod, "TEagle$G1", $mod.TBird$G2, function () {', + 'rtl.createClass(this, "TEagle$G1", this.TBird$G2, function () {', '});', 'this.a = null;', '']), @@ -598,13 +598,13 @@ begin CheckSource('TestGen_Class_TypeInfo', LinesToStr([ // statements '$mod.$rtti.$Class("TBird<System.Word>");', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird$G1", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird$G1", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.m = 0;', @@ -643,7 +643,7 @@ begin ConvertProgram; CheckSource('TestGen_Class_TypeOverload', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -674,13 +674,13 @@ begin ConvertProgram; CheckSource('TestGen_Class_ClassProperty', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird$G1", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird$G1", this.TObject, function () {', ' this.fSize = 0;', '});', '']), @@ -724,13 +724,13 @@ begin ConvertProgram; CheckSource('TestGen_Class_ClassProc', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TPoint$G1", $mod.TObject, function () {', + 'rtl.createClass(this, "TPoint$G1", this.TObject, function () {', ' this.x = 0;', ' this.Fly = function () {', ' $mod.TPoint$G1.x = $mod.TPoint$G1.x + 3;', @@ -787,20 +787,20 @@ begin ConvertProgram; CheckSource('TestGen_Class_ClassConstructor', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', 'this.count = 0;', - 'rtl.createClass($mod, "TPoint$G1", $mod.TObject, function () {', + 'rtl.createClass(this, "TPoint$G1", this.TObject, function () {', ' this.x = 0;', ' this.Fly = function () {', ' };', '});', 'this.r = null;', - 'rtl.createClass($mod, "TPoint$G2", $mod.TObject, function () {', + 'rtl.createClass(this, "TPoint$G2", this.TObject, function () {', ' this.x = 0;', ' this.Fly = function () {', ' };', @@ -845,19 +845,19 @@ begin ConvertProgram; CheckSource('TestGen_Class_TypeCastSpecializesWarn', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird$G1", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird$G1", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.F = 0;', ' };', '});', - 'rtl.createClass($mod, "TBird$G2", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird$G2", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.F = "";', @@ -893,19 +893,19 @@ begin ConvertProgram; CheckSource('TestGen_Class_TypeCastSpecializesJSValueNoWarn', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird$G1", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird$G1", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.F = 0;', ' };', '});', - 'rtl.createClass($mod, "TBird$G2", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird$G2", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.F = undefined;', @@ -1001,7 +1001,7 @@ begin LinesToStr([ // statements 'rtl.module("UnitA", ["system"], function () {', ' var $mod = this;', - ' rtl.createClass($mod, "TBird$G1", pas.system.TObject, function () {', + ' rtl.createClass(this, "TBird$G1", pas.system.TObject, function () {', ' this.c = 13;', ' var c$1 = 14;', ' this.Create$1 = function (w) {', @@ -1012,7 +1012,7 @@ begin ' return this;', ' };', ' });', - ' rtl.createClass($mod, "TBird$G2", pas.system.TObject, function () {', + ' rtl.createClass(this, "TBird$G2", pas.system.TObject, function () {', ' this.c = 13;', ' var c$1 = 14;', ' this.Create$1 = function (w) {', @@ -1072,15 +1072,15 @@ begin LinesToStr([ // statements '$mod.$rtti.$Class("TAnt<System.Word>");', '$mod.$rtti.$Class("TFish<System.Word>");', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TPersistent", $mod.TObject, function () {', + 'rtl.createClass(this, "TPersistent", this.TObject, function () {', '});', - 'rtl.createClass($mod, "TAnt$G2", $mod.TPersistent, function () {', + 'rtl.createClass(this, "TAnt$G2", this.TPersistent, function () {', ' this.$init = function () {', ' $mod.TPersistent.$init.call(this);', ' this.f = null;', @@ -1092,7 +1092,7 @@ begin ' var $r = this.$rtti;', ' $r.addField("f", $mod.$rtti["TFish<System.Word>"]);', '}, "TAnt<System.Word>");', - 'rtl.createClass($mod, "TFish$G2", $mod.TPersistent, function () {', + 'rtl.createClass(this, "TFish$G2", this.TPersistent, function () {', ' this.$init = function () {', ' $mod.TPersistent.$init.call(this);', ' this.a = null;', @@ -1144,7 +1144,7 @@ begin 'rtl.module("UnitA", ["system"], function () {', ' var $mod = this;', ' var $impl = $mod.$impl;', - ' rtl.createClass($mod, "TAnt$G1", pas.system.TObject, function () {', + ' rtl.createClass(this, "TAnt$G1", pas.system.TObject, function () {', ' this.$initSpec = function () {', ' this.x = $impl.TBird.$new();', ' this.a = rtl.arraySetLength(null, $impl.TBird, 2);', @@ -1312,11 +1312,11 @@ begin ConvertProgram; CheckSource('TestGen_ExtClass_RTTI', LinesToStr([ // statements - '$mod.$rtti.$ExtClass("TGJSSET<System.JSValue>", {', + 'this.$rtti.$ExtClass("TGJSSET<System.JSValue>", {', ' jsclass: "SET"', '});', - '$mod.$rtti.$RefToProcVar("TJSSetEventProc", {', - ' procsig: rtl.newTIProcSig([["value", rtl.jsvalue], ["key", rtl.nativeint], ["set_", $mod.$rtti["TGJSSET<System.JSValue>"]]])', + 'this.$rtti.$RefToProcVar("TJSSetEventProc", {', + ' procsig: rtl.newTIProcSig([["value", rtl.jsvalue], ["key", rtl.nativeint], ["set_", this.$rtti["TGJSSET<System.JSValue>"]]])', '});', 'this.p = null;', '']), @@ -1358,7 +1358,7 @@ begin 'rtl.module("UnitA", ["system"], function () {', ' var $mod = this;', ' var $impl = $mod.$impl;', - ' $mod.$rtti.$ExtClass("TAnt<UnitA.TBird>", {', + ' this.$rtti.$ExtClass("TAnt<UnitA.TBird>", {', ' jsclass: "SET"', ' });', ' $mod.$implcode = function () {', @@ -1422,15 +1422,15 @@ begin ConvertProgram; CheckSource('TestGen_ClassInterface_Corba', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{00000000-0000-0000-C000-000000000046}", [], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{00000000-0000-0000-C000-000000000046}", [], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createInterface($mod, "IBird$G2", "{33AB51C6-6240-3BDF-B4B0-D48A593EAB0A}", ["GetSize", "SetSize", "DoIt"], $mod.IUnknown);', - 'rtl.createClass($mod, "TBird$G1", $mod.TObject, function () {', + 'rtl.createInterface(this, "IBird$G2", "{33AB51C6-6240-3BDF-B4B0-D48A593EAB0A}", ["GetSize", "SetSize", "DoIt"], this.IUnknown);', + 'rtl.createClass(this, "TBird$G1", this.TObject, function () {', ' rtl.addIntf(this, $mod.IBird$G2);', '});', 'this.BirdIntf = null;', @@ -1461,9 +1461,9 @@ begin ConvertProgram; CheckSource('TestGen_ClassInterface_InterfacedObject', LinesToStr([ // statements - 'rtl.createInterface($mod, "IComparer$G2", "{505778ED-F783-4456-9691-32F419CC5E18}", ["Compare"], pas.system.IUnknown);', + 'rtl.createInterface(this, "IComparer$G2", "{505778ED-F783-4456-9691-32F419CC5E18}", ["Compare"], pas.system.IUnknown);', 'this.aComparer = null;', - 'rtl.createClass($mod, "TComparer$G1", pas.system.TInterfacedObject, function () {', + 'rtl.createClass(this, "TComparer$G1", pas.system.TInterfacedObject, function () {', ' this.Compare = function (Left, Right) {', ' var Result = 0;', ' return Result;', @@ -1497,7 +1497,7 @@ begin ConvertProgram; CheckSource('TestGen_InlineSpec_Constructor', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -1506,7 +1506,7 @@ begin ' return this;', ' };', '});', - 'rtl.createClass($mod, "TBird$G1", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird$G1", this.TObject, function () {', '});', 'this.b = null;', '']), @@ -1546,13 +1546,13 @@ begin 'rtl.module("UnitA", ["system"], function () {', ' var $mod = this;', ' var $impl = $mod.$impl;', - ' rtl.createClass($mod, "TBird$G1", pas.system.TObject, function () {', + ' rtl.createClass(this, "TBird$G1", pas.system.TObject, function () {', ' this.Fly = function () {', ' $impl.DoIt();', ' };', ' });', ' this.b = null;', - ' rtl.createClass($mod, "TBird$G2", pas.system.TObject, function () {', + ' rtl.createClass(this, "TBird$G2", pas.system.TObject, function () {', ' this.Fly = function () {', ' $impl.DoIt();', ' };', @@ -1589,13 +1589,13 @@ begin ConvertProgram; CheckSource('TestGen_IntAssignTemplVar', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird$G1", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird$G1", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.m = 0;', @@ -1636,14 +1636,14 @@ begin ConvertProgram; CheckSource('TestGen_TypeCastDotField', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', 'this.o = null;', - 'rtl.createClass($mod, "TBird$G1", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird$G1", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.Field = 0;', @@ -1682,7 +1682,7 @@ begin ConvertProgram; CheckSource('TestGen_HelperForArray', LinesToStr([ // statements - 'rtl.createHelper($mod, "TWordArrHelper", null, function () {', + 'rtl.createHelper(this, "TWordArrHelper", null, function () {', ' this.Fly = function (w) {', ' };', '});', @@ -2013,7 +2013,7 @@ begin ConvertProgram; CheckSource('TestGenMethod_ObjFPC', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -2069,13 +2069,13 @@ begin 'rtl.module("UnitA", ["system"], function () {', ' var $mod = this;', ' var $impl = $mod.$impl;', - ' $mod.$rtti.$DynArray("TDyn<UnitA.TBird>", {});', + ' this.$rtti.$DynArray("TDyn<UnitA.TBird>", {});', ' this.TStatic$G1$clone = function (a) {', ' var r = [];', ' for (var i = 0; i < 2; i++) r.push($impl.TBird.$clone(a[i]));', ' return r;', ' };', - ' $mod.$rtti.$StaticArray("TStatic<UnitA.TBird>", {', + ' this.$rtti.$StaticArray("TStatic<UnitA.TBird>", {', ' dims: [2]', ' });', ' $mod.$implcode = function () {', @@ -2195,7 +2195,7 @@ begin 'rtl.module("UnitA", ["system"], function () {', ' var $mod = this;', ' var $impl = $mod.$impl;', - ' $mod.$rtti.$ProcVar("TAnt<UnitA.TBird>", {', + ' this.$rtti.$ProcVar("TAnt<UnitA.TBird>", {', ' init: function () {', ' this.procsig = rtl.newTIProcSig([["a", $mod.$rtti["TBird"], 2]], $mod.$rtti["TBird"]);', ' }', diff --git a/packages/pastojs/tests/tcmodules.pas b/packages/pastojs/tests/tcmodules.pas index 1c846598ae..899da0629b 100644 --- a/packages/pastojs/tests/tcmodules.pas +++ b/packages/pastojs/tests/tcmodules.pas @@ -539,6 +539,7 @@ type Procedure TestClass_ExternalOverrideFail; Procedure TestClass_ExternalVar; Procedure TestClass_Const; + Procedure TestClass_ConstEnum; Procedure TestClass_LocalConstDuplicate_Prg; Procedure TestClass_LocalConstDuplicate_Unit; // ToDo: Procedure TestAdvRecord_LocalConstDuplicate; @@ -2522,13 +2523,13 @@ begin LinesToStr([ 'rtl.module("TEST.UnitA", ["system"], function () {', ' var $mod = this;', - ' rtl.createClass($mod, "TObject", null, function () {', + ' rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', ' });', - ' rtl.createClass($mod, "TTestA", $mod.TObject, function () {', + ' rtl.createClass(this, "TTestA", this.TObject, function () {', ' });', '}, ["TEST.UnitB"]);' ])); @@ -2536,7 +2537,7 @@ begin LinesToStr([ 'rtl.module("TEST.UnitB", ["system","TEST.UnitA"], function () {', ' var $mod = this;', - ' rtl.createClass($mod, "TTestB", pas["TEST.UnitA"].TTestA, function () {', + ' rtl.createClass(this, "TTestB", pas["TEST.UnitA"].TTestA, function () {', ' });', '});' ])); @@ -4480,7 +4481,7 @@ begin ConvertUnit; CheckSource('TestProc_OverloadUnitCycle', LinesToStr([ // statements - 'rtl.createClass($mod, "TEagle", pas.Unit2.TObject, function () {', + 'rtl.createClass(this, "TEagle", pas.Unit2.TObject, function () {', ' this.DoIt = function (b) {', ' };', ' this.DoIt$1 = function (i) {', @@ -4648,7 +4649,7 @@ begin ConvertProgram; CheckSource('TestProc_LocalVarAbsolute', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.Index = 0;', ' };', @@ -4976,7 +4977,7 @@ begin ConvertProgram; CheckSource('TestAnonymousProc_With', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.b = false;', ' };', @@ -5020,7 +5021,7 @@ begin ConvertProgram; CheckSource('TestAnonymousProc_ExceptOn', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.b = false;', ' };', @@ -5080,7 +5081,7 @@ begin ConvertProgram; CheckSource('TestAnonymousProc_Nested', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.i = 0;', ' };', @@ -5193,7 +5194,7 @@ begin ConvertProgram; CheckSource('TestAnonymousProc_Class', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.Size = 0;', ' };', @@ -5265,7 +5266,7 @@ begin Add(' e:=green;'); Add(' e:=default(TMyEnum);'); ConvertProgram; - CheckSource('TestEnumName', + CheckSource('TestEnum_Name', LinesToStr([ // statements 'this.TMyEnum = {', ' "0":"Red",', @@ -5276,7 +5277,7 @@ begin ' Blue:2', ' };', 'this.e = 0;', - 'this.f = $mod.TMyEnum.Blue;' + 'this.f = this.TMyEnum.Blue;' ]), LinesToStr([ '$mod.e=$mod.TMyEnum.Green;', @@ -5704,7 +5705,7 @@ begin 'this.c = 0;', 'this.s = {};', 'this.t = {};', - 'this.u = rtl.createSet($mod.TColor.Red);' + 'this.u = rtl.createSet(this.TColor.Red);' ]), LinesToStr([ '$mod.s={};', @@ -6044,7 +6045,7 @@ begin ' "1": "Blue",', ' Blue: 1', '};', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -6086,7 +6087,7 @@ begin ' "1": "Blue",', ' Blue: 1', '};', - 'this.Orange = $mod.TEnum.Red;', + 'this.Orange = this.TEnum.Red;', 'this.Enum = 0;', 'this.Enums = {};', '']), @@ -6164,7 +6165,7 @@ begin ' "1": "green",', ' green: 1', '};', - 'this.favorite = $mod.TFlags$a.red;', + 'this.favorite = this.TFlags$a.red;', 'this.f = {};', 'this.i = 0;', '']), @@ -6249,8 +6250,8 @@ begin ' "2": "green",', ' green: 2', '};', - 'this.teAny = rtl.createSet(null, $mod.TEnum.red, $mod.TEnum.green);', - 'this.teRedBlue = rtl.createSet(null, $mod.TEnum.red, $mod.TEnum.green - 1);', + 'this.teAny = rtl.createSet(null, this.TEnum.red, this.TEnum.green);', + 'this.teRedBlue = rtl.createSet(null, this.TEnum.red, this.TEnum.green - 1);', 'this.e = 0;', 'this.s = {};', '']), @@ -6292,7 +6293,7 @@ begin CheckSource('TestSet_ConstChar', LinesToStr([ // statements 'this.LowChars = rtl.createSet(null, 97, 122);', - 'this.Chars = rtl.unionSet($mod.LowChars, rtl.createSet(null, 65, 90));', + 'this.Chars = rtl.unionSet(this.LowChars, rtl.createSet(null, 65, 90));', 'this.sc = rtl.createSet(1040, 1071);', 'this.c = "";', 'this.s = "";', @@ -6328,7 +6329,7 @@ begin CheckSource('TestSet_ConstInt', LinesToStr([ // statements 'this.Months = rtl.createSet(null, 1, 12);', - 'this.Mirror = rtl.unionSet(rtl.createSet(null, -12, -1), $mod.Months);', + 'this.Mirror = rtl.unionSet(rtl.createSet(null, -12, -1), this.Months);', 'this.i = 0;', '']), LinesToStr([ @@ -6908,7 +6909,7 @@ begin 'this.s3 = rtl.createSet(null, 1, 3);', 'this.s4 = rtl.createSet(null, -128, 127);', 'this.s5 = rtl.createSet(null, -128 + 1, 127 - 1);', - 'this.s6 = 1 in $mod.s2;', + 'this.s6 = 1 in this.s2;', 'this.i = 0;', 'this.i2 = 0;', '']), @@ -7120,10 +7121,10 @@ begin CheckSource('TestCurrency', LinesToStr([ 'this.a = 27000;', - 'this.b = $mod.a + 17000;', + 'this.b = this.a + 17000;', 'this.MinSafeIntCurrency = -92233720368.5477;', 'this.MaxSafeIntCurrency = 92233720368.5477;', - 'this.c = $mod.b;', + 'this.c = this.b;', 'this.i = 0;', 'this.d = 0.0;', 'this.j = undefined;', @@ -8283,19 +8284,19 @@ begin ConvertProgram; CheckSource('TestTryExcept', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "Exception", $mod.TObject, function () {', + 'rtl.createClass(this, "Exception", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.Msg = "";', ' };', '});', - 'rtl.createClass($mod, "EInvalidCast", $mod.Exception, function () {', + 'rtl.createClass(this, "EInvalidCast", this.Exception, function () {', '});', 'this.vI = 0;' ]), @@ -8353,13 +8354,13 @@ begin ConvertProgram; CheckSource('TestTryExcept_ReservedWords', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "Exception", $mod.TObject, function () {', + 'rtl.createClass(this, "Exception", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.Symbol = "";', @@ -8400,7 +8401,7 @@ begin ConvertProgram; CheckSource('TestIfThenRaiseElse', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -9139,7 +9140,7 @@ begin ConvertProgram; CheckSource('TestArrayOfRecord', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.Int = 0;', ' this.$eq = function (b) {', ' return this.Int === b.Int;', @@ -9152,7 +9153,7 @@ begin 'this.DoIt = function (vd, vc, vv) {', '};', 'this.Arr = [];', - 'this.r = $mod.TRec.$new();', + 'this.r = this.TRec.$new();', 'this.i = 0;' ]), LinesToStr([ // $mod.$main @@ -9185,7 +9186,7 @@ begin ConvertProgram; CheckSource('TestArray_StaticRecord', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.Int = 0;', ' this.$eq = function (b) {', ' return this.Int === b.Int;', @@ -9200,7 +9201,7 @@ begin ' for (var i = 0; i < 2; i++) r.push($mod.TRec.$clone(a[i]));', ' return r;', '};', - 'this.Arr = rtl.arraySetLength(null, $mod.TRec, 2);', + 'this.Arr = rtl.arraySetLength(null, this.TRec, 2);', '']), LinesToStr([ // $mod.$main '$mod.Arr[0].Int = 2 + 1 + 2;'])); @@ -9595,7 +9596,7 @@ begin ConvertProgram; CheckSource('TestArray_SetLengthProperty', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -9848,7 +9849,7 @@ begin ' "1": "small",', ' small: 1', '};', - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.i = 0;', ' this.$eq = function (b) {', ' return this.i === b.i;', @@ -9928,7 +9929,7 @@ begin ' "1": "small",', ' small: 1', '};', - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.i = 0;', ' this.$eq = function (b) {', ' return this.i === b.i;', @@ -10003,7 +10004,7 @@ begin ' "1": "small",', ' small: 1', '};', - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.i = 0;', ' this.$eq = function (b) {', ' return this.i === b.i;', @@ -10073,7 +10074,7 @@ begin 'this.OneStr = [7];', 'this.Chars = ["a", "o", "c"];', 'this.Names = ["a", "foo"];', - 'this.NameCount = 0 + (rtl.length($mod.Names) - 1) + rtl.length($mod.Names);', + 'this.NameCount = 0 + (rtl.length(this.Names) - 1) + rtl.length(this.Names);', 'this.i = 0;', '']), LinesToStr([ // $mod.$main @@ -10119,7 +10120,7 @@ begin 'this.OneStr = rtl.arrayConcatN([7],[8]);', 'this.Chars = ["a", "o", "c"];', 'this.Names = ["a", "a"];', - 'this.NameCount = 0 + (rtl.length($mod.Names) - 1) + rtl.length($mod.Names);', + 'this.NameCount = 0 + (rtl.length(this.Names) - 1) + rtl.length(this.Names);', '']), LinesToStr([ // $mod.$main ''])); @@ -10352,7 +10353,7 @@ begin ConvertProgram; CheckSource('TestArray_ForInArrOfString', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -10555,13 +10556,13 @@ begin ConvertProgram; CheckSource('TestArrayOfConst_PassObj', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createInterface($mod, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', + 'rtl.createInterface(this, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', 'this.Say = function (args) {', '};', 'this.o = null;', @@ -10594,7 +10595,7 @@ begin ConvertProgram; CheckSource('TestRecord_Empty', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRecA", function () {', + 'rtl.recNewT(this, "TRecA", function () {', ' this.$eq = function (b) {', ' return true;', ' };', @@ -10602,8 +10603,8 @@ begin ' return this;', ' };', '});', - 'this.a = $mod.TRecA.$new();', - 'this.b = $mod.TRecA.$new();', + 'this.a = this.TRecA.$new();', + 'this.b = this.TRecA.$new();', '']), LinesToStr([ // $mod.$main 'if ($mod.a.$eq($mod.b)) ;' @@ -10623,7 +10624,7 @@ begin ConvertProgram; CheckSource('TestRecord_Var', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRecA", function () {', + 'rtl.recNewT(this, "TRecA", function () {', ' this.Bold = 0;', ' this.$eq = function (b) {', ' return this.Bold === b.Bold;', @@ -10633,7 +10634,7 @@ begin ' return this;', ' };', '});', - 'this.Rec = $mod.TRecA.$new();', + 'this.Rec = this.TRecA.$new();', '']), LinesToStr([ // $mod.$main '$mod.Rec.Bold = 123;' @@ -10657,7 +10658,7 @@ begin ConvertProgram; CheckSource('TestRecord_VarExternal', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRecA", function () {', + 'rtl.recNewT(this, "TRecA", function () {', ' this.i = 0;', ' this.$eq = function (b) {', ' return (this.i === b.i) && (this.length === b.length);', @@ -10668,7 +10669,7 @@ begin ' return this;', ' };', '});', - 'this.Rec = $mod.TRecA.$new();', + 'this.Rec = this.TRecA.$new();', '']), LinesToStr([ // $mod.$main '$mod.Rec.length = $mod.Rec.length;' @@ -10695,7 +10696,7 @@ begin ConvertProgram; CheckSource('TestWithRecordDo', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.vI = 0;', ' this.$eq = function (b) {', ' return this.vI === b.vI;', @@ -10706,7 +10707,7 @@ begin ' };', '});', 'this.Int = 0;', - 'this.r = $mod.TRec.$new();', + 'this.r = this.TRec.$new();', '']), LinesToStr([ // $mod.$main 'var $with = $mod.r;', @@ -10749,7 +10750,7 @@ begin ' "1": "green",', ' green: 1', '};', - 'rtl.recNewT($mod, "TSmallRec", function () {', + 'rtl.recNewT(this, "TSmallRec", function () {', ' this.N = 0;', ' this.$eq = function (b) {', ' return this.N === b.N;', @@ -10759,7 +10760,7 @@ begin ' return this;', ' };', '});', - 'rtl.recNewT($mod, "TBigRec", function () {', + 'rtl.recNewT(this, "TBigRec", function () {', ' this.Int = 0;', ' this.D = 0.0;', ' this.$new = function () {', @@ -10783,8 +10784,8 @@ begin ' return this;', ' };', '});', - 'this.r = $mod.TBigRec.$new();', - 'this.s = $mod.TBigRec.$new();', + 'this.r = this.TBigRec.$new();', + 'this.s = this.TBigRec.$new();', '']), LinesToStr([ // $mod.$main '$mod.r.$assign($mod.s);', @@ -10830,7 +10831,7 @@ begin ConvertProgram; CheckSource('TestRecord_AsParams', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRecord", function () {', + 'rtl.recNewT(this, "TRecord", function () {', ' this.i = 0;', ' this.$eq = function (b) {', ' return this.i === b.i;', @@ -10860,7 +10861,7 @@ begin ' $mod.DoIt($mod.TRecord.$clone(vL), vL, vL, vL);', ' U.i = 3;', '};', - 'this.i = $mod.TRecord.$new();' + 'this.i = this.TRecord.$new();' ]), LinesToStr([ '$mod.DoIt($mod.TRecord.$clone($mod.i), $mod.i, $mod.i, $mod.i);', @@ -10891,7 +10892,7 @@ begin CheckResolverUnexpectedHints(); CheckSource('TestRecord_ConstRef', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.i = 0;', ' this.$eq = function (b) {', ' return this.i === b.i;', @@ -10936,7 +10937,7 @@ begin ConvertProgram; CheckSource('TestRecordElement_AsParams', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRecord", function () {', + 'rtl.recNewT(this, "TRecord", function () {', ' this.i = 0;', ' this.$eq = function (b) {', ' return this.i === b.i;', @@ -10958,7 +10959,7 @@ begin ' }', ' });', '};', - 'this.r = $mod.TRecord.$new();' + 'this.r = this.TRecord.$new();' ]), LinesToStr([ '$mod.DoIt($mod.r.i,$mod.r.i,{', @@ -10994,7 +10995,7 @@ begin ConvertProgram; CheckSource('TestRecordElementFromFuncResult_AsParams', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRecord", function () {', + 'rtl.recNewT(this, "TRecord", function () {', ' this.i = 0;', ' this.$eq = function (b) {', ' return this.i === b.i;', @@ -11036,7 +11037,7 @@ begin ConvertProgram; CheckSource('TestRecordElementFromWith_AsParams', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRecord", function () {', + 'rtl.recNewT(this, "TRecord", function () {', ' this.i = 0;', ' this.$eq = function (b) {', ' return this.i === b.i;', @@ -11048,7 +11049,7 @@ begin '});', 'this.DoIt = function (vG,vH,vI) {', '};', - 'this.r = $mod.TRecord.$new();' + 'this.r = this.TRecord.$new();' ]), LinesToStr([ 'var $with = $mod.r;', @@ -11095,7 +11096,7 @@ begin ' "1": "blue",', ' blue: 1', '};', - 'rtl.recNewT($mod, "TRecord", function () {', + 'rtl.recNewT(this, "TRecord", function () {', ' this.i = 0;', ' this.Event = null;', ' this.$new = function () {', @@ -11113,7 +11114,7 @@ begin ' return this;', ' };', '});', - 'rtl.recNewT($mod, "TNested", function () {', + 'rtl.recNewT(this, "TNested", function () {', ' this.$new = function () {', ' var r = Object.create(this);', ' r.r = $mod.TRecord.$new();', @@ -11128,8 +11129,8 @@ begin ' };', '});', 'this.b = false;', - 'this.r = $mod.TRecord.$new();', - 'this.s = $mod.TRecord.$new();', + 'this.r = this.TRecord.$new();', + 'this.s = this.TRecord.$new();', '']), LinesToStr([ '$mod.b = $mod.r.$eq($mod.s);', @@ -11168,7 +11169,7 @@ begin ConvertProgram; CheckSource('TestRecord_JSValue', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRecord", function () {', + 'rtl.recNewT(this, "TRecord", function () {', ' this.i = 0;', ' this.$eq = function (b) {', ' return this.i === b.i;', @@ -11186,7 +11187,7 @@ begin ' if (v) ;', '};', 'this.Jv = undefined;', - 'this.Rec = $mod.TRecord.$new();', + 'this.Rec = this.TRecord.$new();', '']), LinesToStr([ '$mod.Rec.$assign(rtl.getObject($mod.Jv));', @@ -11231,7 +11232,7 @@ begin ConvertProgram; CheckSource('TestRecord_FieldArray', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.$new = function () {', ' var r = Object.create(this);', ' r.a = [];', @@ -11284,7 +11285,7 @@ begin ConvertProgram; CheckSource('TestRecord_Const', LinesToStr([ // statements - 'rtl.recNewT($mod, "TPoint", function () {', + 'rtl.recNewT(this, "TPoint", function () {', ' this.x = 0;', ' this.y = 0;', ' this.$eq = function (b) {', @@ -11296,7 +11297,7 @@ begin ' return this;', ' };', '});', - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.i = 0;', ' this.$new = function () {', ' var r = Object.create(this);', @@ -11318,20 +11319,20 @@ begin ' return this;', ' };', '});', - 'this.r = $mod.TRec.$clone({', + 'this.r = this.TRec.$clone({', ' i: 1,', ' a: [2, 3],', ' s: [4, 5],', ' m: [[11, 12], [13, 14]],', - ' p: $mod.TPoint.$clone({', + ' p: this.TPoint.$clone({', ' x: 21,', ' y: 22', ' })', '});', - 'this.p = [$mod.TPoint.$clone({', + 'this.p = [this.TPoint.$clone({', ' x: 1,', ' y: 2', - '}), $mod.TPoint.$clone({', + '}), this.TPoint.$clone({', ' x: 3,', ' y: 4', '})];', @@ -11436,7 +11437,7 @@ begin ConvertProgram; CheckSource('TestAdvRecord_Function', LinesToStr([ // statements - 'rtl.recNewT($mod, "TPoint", function () {', + 'rtl.recNewT(this, "TPoint", function () {', ' this.x = 0;', ' this.y = 0;', ' this.$eq = function (b) {', @@ -11456,8 +11457,8 @@ begin ' return Result;', ' };', '});', - 'this.p = $mod.TPoint.$new();', - 'this.q = $mod.TPoint.$new();', + 'this.p = this.TPoint.$new();', + 'this.q = this.TPoint.$new();', '']), LinesToStr([ // $mod.$main '$mod.p.Add($mod.q);', @@ -11499,7 +11500,7 @@ begin ConvertProgram; CheckSource('TestAdvRecord_Property', LinesToStr([ // statements - 'rtl.recNewT($mod, "TPoint", function () {', + 'rtl.recNewT(this, "TPoint", function () {', ' this.x = 0;', ' this.y = 0;', ' this.$eq = function (b) {', @@ -11522,8 +11523,8 @@ begin '});', 'this.SetSize = function (Value) {', '};', - 'this.p = $mod.TPoint.$new();', - 'this.q = $mod.TPoint.$new();', + 'this.p = this.TPoint.$new();', + 'this.q = this.TPoint.$new();', '']), LinesToStr([ // $mod.$main '$mod.p.SetSize($mod.q.GetSize());', @@ -11560,7 +11561,7 @@ begin ConvertProgram; CheckSource('TestAdvRecord_PropertyDefault', LinesToStr([ // statements - 'rtl.recNewT($mod, "TPoint", function () {', + 'rtl.recNewT(this, "TPoint", function () {', ' this.$eq = function (b) {', ' return true;', ' };', @@ -11576,7 +11577,7 @@ begin ' this.SetItems = function (Index, Value) {', ' };', '});', - 'this.p = $mod.TPoint.$new();', + 'this.p = this.TPoint.$new();', '']), LinesToStr([ // $mod.$main '$mod.p.SetItems(1, $mod.p.GetItems(2));', @@ -11625,7 +11626,7 @@ begin ConvertProgram; CheckSource('TestAdvRecord_Property_ClassMethod', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.Fx = 0;', ' this.Fy = 0;', ' this.$eq = function (b) {', @@ -11646,7 +11647,7 @@ begin ' $mod.TRec.SetInt($mod.TRec.GetInt() + 1);', ' };', '}, true);', - 'this.r = $mod.TRec.$new();', + 'this.r = this.TRec.$new();', '']), LinesToStr([ // $mod.$main '$mod.TRec.Fy = $mod.TRec.Fx + 1;', @@ -11692,7 +11693,7 @@ begin ConvertProgram; CheckSource('TestAdvRecord_Const', LinesToStr([ // statements - 'rtl.recNewT($mod, "TPoint", function () {', + 'rtl.recNewT(this, "TPoint", function () {', ' this.x = 0;', ' this.y = 0;', ' this.Count = 0;', @@ -11705,7 +11706,7 @@ begin ' return this;', ' };', '}, true);', - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.i = 0;', ' this.$new = function () {', ' var r = Object.create(this);', @@ -11727,20 +11728,20 @@ begin ' return this;', ' };', '});', - 'this.r = $mod.TRec.$clone({', + 'this.r = this.TRec.$clone({', ' i: 1,', ' a: [2, 3],', ' s: [4, 5],', ' m: [[11, 12], [13, 14]],', - ' p: $mod.TPoint.$clone({', + ' p: this.TPoint.$clone({', ' x: 21,', ' y: 0', ' })', '});', - 'this.p = [$mod.TPoint.$clone({', + 'this.p = [this.TPoint.$clone({', ' x: 1,', ' y: 2', - '}), $mod.TPoint.$clone({', + '}), this.TPoint.$clone({', ' x: 3,', ' y: 4', '})];', @@ -11782,7 +11783,7 @@ begin ConvertProgram; CheckSource('TestAdvRecord_ExternalField', LinesToStr([ // statements - 'rtl.recNewT($mod, "TCar", function () {', + 'rtl.recNewT(this, "TCar", function () {', ' this.$eq = function (b) {', ' return (this.$Intern === b.$Intern) && (this.$Intern2 === b.$Intern2) && (this["A B"] === b["A B"]);', ' };', @@ -11798,7 +11799,7 @@ begin ' this["A B"] = this["A B"] + 3;', ' };', '});', - 'this.Rec = $mod.TCar.$clone({', + 'this.Rec = this.TCar.$clone({', ' $Intern: 11,', ' $Intern2: 12,', ' "A B": 13', @@ -11856,7 +11857,7 @@ begin ConvertProgram; CheckSource('TestAdvRecord_SubRecord', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' rtl.recNewT(this, "TPoint", function () {', ' this.x = 0;', ' this.y = 0;', @@ -11895,9 +11896,9 @@ begin ' this.TPoint.Count = this.p.Count + 2;', ' };', '}, true);', - 'this.r = $mod.TRec.$clone({', + 'this.r = this.TRec.$clone({', ' i: 1,', - ' p: $mod.TRec.TPoint.$clone({', + ' p: this.TRec.TPoint.$clone({', ' x: 21,', ' y: 22', ' })', @@ -11945,14 +11946,14 @@ begin ConvertProgram; CheckSource('TestAdvRecord_SubClass', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.recNewT($mod, "TPoint", function () {', - ' rtl.createClass(this, "TBird", $mod.TObject, function () {', + 'rtl.recNewT(this, "TPoint", function () {', + ' rtl.createClass(this, "TBird", this.TObject, function () {', ' this.DoIt = function () {', ' this.DoIt();', ' this.DoIt();', @@ -12023,7 +12024,7 @@ begin ConvertProgram; CheckSource('TestAdvRecord_Constructor', LinesToStr([ // statements - 'rtl.recNewT($mod, "TPoint", function () {', + 'rtl.recNewT(this, "TPoint", function () {', ' this.x = 0;', ' this.y = 0;', ' this.$eq = function (b) {', @@ -12040,7 +12041,7 @@ begin ' return this;', ' };', '}, true);', - 'this.r = $mod.TPoint.$new();', + 'this.r = this.TPoint.$new();', '']), LinesToStr([ // $mod.$main '$mod.r.$assign($mod.TPoint.$new().Create(1, 2));', @@ -12083,7 +12084,7 @@ begin ConvertProgram; CheckSource('TestAdvRecord_ClassConstructor_Program', LinesToStr([ // statements - 'rtl.recNewT($mod, "TPoint", function () {', + 'rtl.recNewT(this, "TPoint", function () {', ' this.x = 0;', ' this.$eq = function (b) {', ' return true;', @@ -12095,7 +12096,7 @@ begin ' };', '}, true);', 'this.count = 0;', - 'this.r = $mod.TPoint.$new();', + 'this.r = this.TPoint.$new();', '']), LinesToStr([ // $mod.$main '(function () {', @@ -12141,7 +12142,7 @@ begin CheckSource('TestAdvRecord_ClassConstructor_Unit', LinesToStr([ // statements 'var $impl = $mod.$impl;', - 'rtl.recNewT($mod, "TPoint", function () {', + 'rtl.recNewT(this, "TPoint", function () {', ' this.x = 0;', ' this.$eq = function (b) {', ' return true;', @@ -12193,7 +12194,7 @@ begin ConvertProgram; CheckSource('TestClass_TObjectDefaultConstructor', LinesToStr([ // statements - 'rtl.createClass($mod,"TObject",null,function(){', + 'rtl.createClass(this,"TObject",null,function(){', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -12232,7 +12233,7 @@ begin ConvertProgram; CheckSource('TestClass_TObjectConstructorWithParams', LinesToStr([ // statements - 'rtl.createClass($mod,"TObject",null,function(){', + 'rtl.createClass(this,"TObject",null,function(){', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -12271,7 +12272,7 @@ begin ConvertProgram; CheckSource('TestClass_TObjectConstructorWithDefaultParam', LinesToStr([ // statements - 'rtl.createClass($mod,"TObject",null,function(){', + 'rtl.createClass(this,"TObject",null,function(){', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -12280,7 +12281,7 @@ begin ' return this;', ' };', '});', - 'rtl.createClass($mod, "TTest", $mod.TObject, function () {', + 'rtl.createClass(this, "TTest", this.TObject, function () {', ' this.Create$1 = function (Par) {', ' return this;', ' };', @@ -12314,7 +12315,7 @@ begin ConvertProgram; CheckSource('TestClass_Var', LinesToStr([ // statements - 'rtl.createClass($mod,"TObject",null,function(){', + 'rtl.createClass(this,"TObject",null,function(){', ' this.$init = function () {', ' this.vI = 0;', ' };', @@ -12362,7 +12363,7 @@ begin ConvertProgram; CheckSource('TestClass_Method', LinesToStr([ // statements - 'rtl.createClass($mod,"TObject",null,function(){', + 'rtl.createClass(this,"TObject",null,function(){', ' this.$init = function () {', ' this.vI = 0;', ' this.Sub = null;', @@ -12432,7 +12433,7 @@ begin CheckSource('TestClass_Implementation', LinesToStr([ // statements 'var $impl = $mod.$impl;', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -12492,7 +12493,7 @@ begin ConvertProgram; CheckSource('TestClass_Inheritance', LinesToStr([ // statements - 'rtl.createClass($mod,"TObject",null,function(){', + 'rtl.createClass(this,"TObject",null,function(){', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -12501,9 +12502,9 @@ begin ' return this;', ' };', '});', - 'rtl.createClass($mod,"TClassA",$mod.TObject,function(){', + 'rtl.createClass(this,"TClassA",this.TObject,function(){', '});', - 'rtl.createClass($mod,"TClassB",$mod.TObject,function(){', + 'rtl.createClass(this,"TClassB",this.TObject,function(){', ' this.ProcB = function () {', ' };', '});', @@ -12544,15 +12545,15 @@ begin ConvertProgram; CheckSource('TestClass_TypeAlias', LinesToStr([ // statements - 'rtl.createInterface($mod, "IObject", "{B92D5841-6F2A-306A-8000-000000000000}", [], null);', - 'rtl.createInterface($mod, "IBird", "{4B0D080B-C0F6-387B-AE88-F10981585074}", [], $mod.IObject);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IObject", "{B92D5841-6F2A-306A-8000-000000000000}", [], null);', + 'rtl.createInterface(this, "IBird", "{4B0D080B-C0F6-387B-AE88-F10981585074}", [], this.IObject);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', '});', 'this.oObj = null;', 'this.oBird = null;', @@ -12576,7 +12577,7 @@ begin ConvertProgram; CheckSource('TestClass_AbstractMethod', LinesToStr([ // statements - 'rtl.createClass($mod,"TObject",null,function(){', + 'rtl.createClass(this,"TObject",null,function(){', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -12630,7 +12631,7 @@ begin ConvertProgram; CheckSource('TestClass_CallInherited_ProcNoParams', LinesToStr([ // statements - 'rtl.createClass($mod,"TObject",null,function(){', + 'rtl.createClass(this,"TObject",null,function(){', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -12640,7 +12641,7 @@ begin ' this.DoIt = function () {', ' };', '});', - 'rtl.createClass($mod, "TA", $mod.TObject, function () {', + 'rtl.createClass(this, "TA", this.TObject, function () {', ' this.DoAbstract = function () {', ' $mod.TObject.DoVirtual.call(this);', ' };', @@ -12712,7 +12713,7 @@ begin ConvertProgram; CheckSource('TestClass_CallInherited_WithParams', LinesToStr([ // statements - 'rtl.createClass($mod,"TObject",null,function(){', + 'rtl.createClass(this,"TObject",null,function(){', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -12728,7 +12729,7 @@ begin ' return Result;', ' };', '});', - 'rtl.createClass($mod, "TClassA", $mod.TObject, function () {', + 'rtl.createClass(this, "TClassA", this.TObject, function () {', ' this.DoAbstract = function (pA,pB) {', ' $mod.TObject.DoVirtual.call(this,pA,pB);', ' $mod.TObject.DoVirtual.call(this,pA,0);', @@ -12807,7 +12808,7 @@ begin ConvertProgram; CheckSource('TestClass_CallInheritedConstructor', LinesToStr([ // statements - 'rtl.createClass($mod,"TObject",null,function(){', + 'rtl.createClass(this,"TObject",null,function(){', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -12820,7 +12821,7 @@ begin ' return this;', ' };', '});', - 'rtl.createClass($mod, "TA", $mod.TObject, function () {', + 'rtl.createClass(this, "TA", this.TObject, function () {', ' this.Create = function () {', ' $mod.TObject.Create.call(this);', ' $mod.TObject.Create.call(this);', @@ -12891,7 +12892,7 @@ begin ConvertProgram; CheckSource('TestClass_ClassVar_Assign', LinesToStr([ // statements - 'rtl.createClass($mod,"TObject",null,function(){', + 'rtl.createClass(this,"TObject",null,function(){', ' this.vI = 0;', ' this.Sub = null;', ' this.$init = function () {', @@ -12979,7 +12980,7 @@ begin ConvertProgram; CheckSource('TestClass_CallClassMethod', LinesToStr([ // statements - 'rtl.createClass($mod,"TObject",null,function(){', + 'rtl.createClass(this,"TObject",null,function(){', ' this.vI = 0;', ' this.Sub = null;', ' this.$init = function () {', @@ -13061,7 +13062,7 @@ begin ConvertProgram; CheckSource('TestClass_Property', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.Fx = 0;', ' this.Fy = 0;', @@ -13155,7 +13156,7 @@ begin ConvertProgram; CheckSource('TestClass_Property_ClassMethod', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.Fx = 0;', ' this.Fy = 0;', ' this.$init = function () {', @@ -13170,7 +13171,7 @@ begin ' this.SetInt = function (Value) {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.DoIt = function () {', ' $mod.TObject.Fx = 3;', ' $mod.TObject.Fy = this.Fx + 1;', @@ -13239,7 +13240,7 @@ begin ConvertProgram; CheckSource('TestClass_Property_Indexed', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FItems = [];', ' };', @@ -13307,7 +13308,7 @@ begin ' "1": "blue",', ' blue: 1', '};', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -13372,7 +13373,7 @@ begin ConvertProgram; CheckSource('TestClass_PropertyOfTypeArray', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FItems = [];', ' };', @@ -13448,13 +13449,13 @@ begin ConvertProgram; CheckSource('TestClass_PropertyDefault', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.FItems = [];', @@ -13521,17 +13522,17 @@ begin ConvertProgram; CheckSource('TestClass_PropertyDefault_TypecastToOtherDefault', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TAlphaList", $mod.TObject, function () {', + 'rtl.createClass(this, "TAlphaList", this.TObject, function () {', '});', - 'rtl.createClass($mod, "TBetaList", $mod.TObject, function () {', + 'rtl.createClass(this, "TBetaList", this.TObject, function () {', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.DoIt = function () {', ' var List = null;', ' if (List.GetAlphas(true).GetBetas(3) === null) ;', @@ -13571,14 +13572,14 @@ begin ConvertProgram; CheckSource('TestClass_PropertyOverride', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FItem = 0;', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TCar", $mod.TObject, function () {', + 'rtl.createClass(this, "TCar", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.FBag = 0;', @@ -13630,7 +13631,7 @@ begin ConvertProgram; CheckSource('TestClass_PropertyIncVisibility', LinesToStr([ // statements - 'rtl.createClass($mod, "TBird", pas.unit1.TObject, function () {', + 'rtl.createClass(this, "TBird", pas.unit1.TObject, function () {', '});', 'this.DoIt = function (i) {', '};', @@ -13658,7 +13659,7 @@ begin ConvertProgram; CheckSource('TestClass_Assigned', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -13705,7 +13706,7 @@ begin ConvertProgram; CheckSource('TestClass_WithClassDoCreate', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.aBool = false;', ' this.Arr = [];', @@ -13771,7 +13772,7 @@ begin ConvertProgram; CheckSource('TestClass_WithClassInstDoProperty', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FInt = 0;', ' };', @@ -13832,7 +13833,7 @@ begin ConvertProgram; CheckSource('TestClass_WithClassInstDoPropertyWithParams', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -13889,7 +13890,7 @@ begin ConvertProgram; CheckSource('TestClass_WithClassInstDoFunc', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -13947,7 +13948,7 @@ begin ConvertProgram; CheckSource('TestClass_TypeCast', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.Next = null;', ' };', @@ -13958,7 +13959,7 @@ begin ' return this;', ' };', '});', - 'rtl.createClass($mod, "TControl", $mod.TObject, function () {', + 'rtl.createClass(this, "TControl", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.Arr = [];', @@ -14018,7 +14019,7 @@ begin ConvertProgram; CheckSource('TestClass_TypeCastUntypedParam', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -14083,7 +14084,7 @@ begin ConvertProgram; CheckSource('TestClass_Overloads', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -14132,7 +14133,7 @@ begin ConvertProgram; CheckSource('TestClass_OverloadsAncestor', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -14144,7 +14145,7 @@ begin ' this.DoIt$1 = function (vA, vB) {', ' };', '});', - 'rtl.createClass($mod, "TCar", $mod.TObject, function () {', + 'rtl.createClass(this, "TCar", this.TObject, function () {', ' this.DoIt$2 = function (vA) {', ' this.DoIt$2(1);', ' this.DoIt$3(1, 2);', @@ -14193,7 +14194,7 @@ begin ConvertProgram; CheckSource('TestClass_OverloadConstructor', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -14207,7 +14208,7 @@ begin ' return this;', ' };', '});', - 'rtl.createClass($mod, "TCar", $mod.TObject, function () {', + 'rtl.createClass(this, "TCar", this.TObject, function () {', ' this.Create$2 = function (vA) {', ' this.Create$2(1);', ' this.Create$3(1, 2);', @@ -14269,13 +14270,13 @@ begin ConvertProgram; CheckSource('TestClass_OverloadDelphiOverride', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.GetValue = function () {', ' var Result = 0;', ' if (3 === this.GetValue()) ;', @@ -14287,7 +14288,7 @@ begin ' return Result;', ' };', '});', - 'rtl.createClass($mod, "TEagle", $mod.TBird, function () {', + 'rtl.createClass(this, "TEagle", this.TBird, function () {', ' this.GetValue = function () {', ' var Result = 0;', ' if (13 === this.GetValue()) ;', @@ -14351,13 +14352,13 @@ begin ConvertProgram; CheckSource('TestClass_ReintroduceVarDelphi', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TAnimal", $mod.TObject, function () {', + 'rtl.createClass(this, "TAnimal", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.A = 0;', @@ -14367,14 +14368,14 @@ begin ' return Result;', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TAnimal, function () {', + 'rtl.createClass(this, "TBird", this.TAnimal, function () {', ' this.$init = function () {', ' $mod.TAnimal.$init.call(this);', ' this.A$1 = 0.0;', ' this.B$1 = false;', ' };', '});', - 'rtl.createClass($mod, "TEagle", $mod.TBird, function () {', + 'rtl.createClass(this, "TEagle", this.TBird, function () {', ' this.$init = function () {', ' $mod.TBird.$init.call(this);', ' this.B$2 = 0.0;', @@ -14423,20 +14424,20 @@ begin ConvertProgram; CheckSource('TestClass_ReintroducedVar', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.Some = 0;', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TMobile", $mod.TObject, function () {', + 'rtl.createClass(this, "TMobile", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.Some$1 = "";', ' };', '});', - 'rtl.createClass($mod, "TCar", $mod.TMobile, function () {', + 'rtl.createClass(this, "TCar", this.TMobile, function () {', ' this.Some$2 = function () {', ' this.Some$2();', ' this.Some$3(1);', @@ -14472,7 +14473,7 @@ begin ConvertProgram; CheckSource('TestClass_RaiseDescendant', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -14481,9 +14482,9 @@ begin ' return this;', ' };', '});', - 'rtl.createClass($mod, "Exception", $mod.TObject, function () {', + 'rtl.createClass(this, "Exception", this.TObject, function () {', '});', - 'rtl.createClass($mod, "EConvertError", $mod.Exception, function () {', + 'rtl.createClass(this, "EConvertError", this.Exception, function () {', '});', 'this.AssertConv = function (Msg) {', ' var Result = null;', @@ -14546,7 +14547,7 @@ begin CheckSource('TestClass_ExternalMethod', LinesToStr([ 'var $impl = $mod.$impl;', - 'rtl.createClass($mod, "TCar", pas.unit2.TObject, function () {', + 'rtl.createClass(this, "TCar", pas.unit2.TObject, function () {', ' this.DoIt = function () {', ' this.$DoIntern();', ' this.$DoIntern();', @@ -14649,7 +14650,7 @@ begin CheckSource('TestClass_ExternalVar', LinesToStr([ 'var $impl = $mod.$impl;', - 'rtl.createClass($mod, "TCar", pas.unit2.TObject, function () {', + 'rtl.createClass(this, "TCar", pas.unit2.TObject, function () {', ' this.DoIt = function () {', ' this.$Intern = this.$Intern + 1;', ' this.$Intern2 = this.$Intern2 + 2;', @@ -14674,51 +14675,52 @@ end; procedure TTestModule.TestClass_Const; begin StartProgram(false); - Add('type'); - Add(' integer = longint;'); - Add(' TClass = class of TObject;'); - Add(' TObject = class'); - Add(' public'); - Add(' const cI: integer = 3;'); - Add(' procedure DoIt;'); - Add(' class procedure DoMore;'); - Add(' end;'); - Add('procedure tobject.doit;'); - Add('begin'); - Add(' if cI=4 then;'); - Add(' if 5=cI then;'); - Add(' if Self.cI=6 then;'); - Add(' if 7=Self.cI then;'); - Add(' with Self do begin'); - Add(' if cI=11 then;'); - Add(' if 12=cI then;'); - Add(' end;'); - Add('end;'); - Add('class procedure tobject.domore;'); - Add('begin'); - Add(' if cI=8 then;'); - Add(' if Self.cI=9 then;'); - Add(' if 10=cI then;'); - Add(' if 11=Self.cI then;'); - Add(' with Self do begin'); - Add(' if cI=13 then;'); - Add(' if 14=cI then;'); - Add(' end;'); - Add('end;'); - Add('var'); - Add(' Obj: TObject;'); - Add(' Cla: TClass;'); - Add('begin'); - Add(' if TObject.cI=21 then ;'); - Add(' if Obj.cI=22 then ;'); - Add(' if Cla.cI=23 then ;'); - Add(' with obj do if ci=24 then;'); - Add(' with TObject do if ci=25 then;'); - Add(' with Cla do if ci=26 then;'); + Add([ + 'type', + ' integer = longint;', + ' TClass = class of TObject;', + ' TObject = class', + ' public', + ' const cI: integer = 3;', + ' procedure DoIt;', + ' class procedure DoMore;', + ' end;', + 'procedure tobject.doit;', + 'begin', + ' if cI=4 then;', + ' if 5=cI then;', + ' if Self.cI=6 then;', + ' if 7=Self.cI then;', + ' with Self do begin', + ' if cI=11 then;', + ' if 12=cI then;', + ' end;', + 'end;', + 'class procedure tobject.domore;', + 'begin', + ' if cI=8 then;', + ' if Self.cI=9 then;', + ' if 10=cI then;', + ' if 11=Self.cI then;', + ' with Self do begin', + ' if cI=13 then;', + ' if 14=cI then;', + ' end;', + 'end;', + 'var', + ' Obj: TObject;', + ' Cla: TClass;', + 'begin', + ' if TObject.cI=21 then ;', + ' if Obj.cI=22 then ;', + ' if Cla.cI=23 then ;', + ' with obj do if ci=24 then;', + ' with TObject do if ci=25 then;', + ' with Cla do if ci=26 then;']); ConvertProgram; CheckSource('TestClass_Const', LinesToStr([ - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.cI = 3;', ' this.$init = function () {', ' };', @@ -14757,6 +14759,70 @@ begin ''])); end; +procedure TTestModule.TestClass_ConstEnum; +begin + StartProgram(false); + Add([ + 'type', + ' TEnum = (red,blue);', + ' TObject = class', + ' end;', + ' TAnimal = class', + ' public', + ' type TSubEnum = (light,dark);', + ' const a = high(TEnum);', + ' const b = high(TSubEnum);', + ' end;', + ' TBird = class(TAnimal)', + ' public', + ' const c = high(TEnum);', + ' const d = high(TSubEnum);', + ' end;', + ' TAnt = class', + ' public', + ' const e = high(TEnum);', + ' const f = high(TBird.TSubEnum);', + ' end;', + 'begin', + '']); + ConvertProgram; + CheckSource('TestClass_ConstEnum', + LinesToStr([ + 'this.TEnum = {', + ' "0": "red",', + ' red: 0,', + ' "1": "blue",', + ' blue: 1', + '};', + 'rtl.createClass(this, "TObject", null, function () {', + ' this.$init = function () {', + ' };', + ' this.$final = function () {', + ' };', + '});', + 'rtl.createClass(this, "TAnimal", this.TObject, function () {', + ' this.TSubEnum = {', + ' "0": "light",', + ' light: 0,', + ' "1": "dark",', + ' dark: 1', + ' };', + ' this.a = $mod.TEnum.blue;', + ' this.b = this.TSubEnum.dark;', + '});', + 'rtl.createClass(this, "TBird", this.TAnimal, function () {', + ' this.c = $mod.TEnum.blue;', + ' this.d = this.TSubEnum.dark;', + '});', + 'rtl.createClass(this, "TAnt", this.TObject, function () {', + ' this.e = $mod.TEnum.blue;', + ' this.f = $mod.TAnimal.TSubEnum.dark;', + '});', + '']), + LinesToStr([ + ''])); +end; + procedure TTestModule.TestClass_LocalConstDuplicate_Prg; begin StartProgram(false); @@ -14790,7 +14856,7 @@ begin ConvertProgram; CheckSource('TestClass_LocalConstDuplicate_Prg', LinesToStr([ - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.cI = 3;', ' this.$init = function () {', ' };', @@ -14805,7 +14871,7 @@ begin ' if (cI$2 === this.cI) ;', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' var cI$3 = 6;', ' this.Go = function () {', ' if (cI$3 === this.cI) ;', @@ -14850,7 +14916,7 @@ begin ConvertUnit; CheckSource('TestClass_LocalConstDuplicate_Unit', LinesToStr([ - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.cI = 3;', ' this.$init = function () {', ' };', @@ -14865,7 +14931,7 @@ begin ' if (cI$2 === this.cI) ;', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' var cI$3 = 6;', ' this.Go = function () {', ' if (cI$3 === this.cI) ;', @@ -14950,7 +15016,7 @@ begin ConvertProgram; CheckSource('TestClass_NestedProcSelf', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.State = 0;', ' this.$init = function () {', ' this.Key = 0;', @@ -14969,12 +15035,12 @@ begin ' $Self.SetSize($Self.GetSize() + 8);', ' };', ' Sub();', - ' $Self.Key = $Self.Key + 12;', + ' this.Key = this.Key + 12;', ' $Self.Key = $Self.Key + 13;', - ' $mod.TObject.State = $Self.State + 14;', + ' $mod.TObject.State = this.State + 14;', ' $mod.TObject.State = $Self.State + 15;', ' $mod.TObject.State = $mod.TObject.State + 16;', - ' $Self.SetSize($Self.GetSize() + 17);', + ' this.SetSize(this.GetSize() + 17);', ' $Self.SetSize($Self.GetSize() + 18);', ' };', '});', @@ -15024,7 +15090,7 @@ begin ConvertProgram; CheckSource('TestClass_NestedProcSelf2', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.State = 0;', ' this.$init = function () {', ' this.Key = 0;', @@ -15032,7 +15098,7 @@ begin ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.DoIt = function () {', ' var $Self = this;', ' function Sub() {', @@ -15045,12 +15111,12 @@ begin ' $Self.SetSize($Self.GetSize() + 8);', ' };', ' Sub();', - ' $Self.Key = $Self.Key + 12;', + ' this.Key = this.Key + 12;', ' $Self.Key = $Self.Key + 13;', - ' $mod.TObject.State = $Self.State + 14;', + ' $mod.TObject.State = this.State + 14;', ' $mod.TObject.State = $Self.State + 15;', ' $mod.TObject.State = $mod.TObject.State + 16;', - ' $Self.SetSize($Self.GetSize() + 17);', + ' this.SetSize(this.GetSize() + 17);', ' $Self.SetSize($Self.GetSize() + 18);', ' };', '});', @@ -15095,7 +15161,7 @@ begin ConvertProgram; CheckSource('TestClass_NestedProcClassSelf', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.State = 0;', ' this.$init = function () {', ' };', @@ -15112,10 +15178,10 @@ begin ' $mod.TObject.SetSize($mod.TObject.GetSize() + 7);', ' };', ' Sub();', - ' $mod.TObject.State = $Self.State + 12;', + ' $mod.TObject.State = this.State + 12;', ' $mod.TObject.State = $Self.State + 13;', ' $mod.TObject.State = $mod.TObject.State + 14;', - ' $Self.SetSize($Self.GetSize() + 15);', + ' this.SetSize(this.GetSize() + 15);', ' $Self.SetSize($Self.GetSize() + 16);', ' $mod.TObject.SetSize($mod.TObject.GetSize() + 17);', ' };', @@ -15156,7 +15222,7 @@ begin ConvertProgram; CheckSource('TestClass_NestedProcCallInherited', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -15166,7 +15232,7 @@ begin ' return Result;', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.DoIt = function (k) {', ' var $Self = this;', ' var Result = 0;', @@ -15174,8 +15240,8 @@ begin ' $mod.TObject.DoIt.call($Self, true);', ' };', ' Sub();', - ' $mod.TObject.DoIt.apply($Self, arguments);', - ' $mod.TObject.DoIt.call($Self, true);', + ' $mod.TObject.DoIt.apply(this, arguments);', + ' $mod.TObject.DoIt.call(this, true);', ' return Result;', ' };', '});', @@ -15226,7 +15292,7 @@ begin ConvertProgram; CheckSource('TestClass_TObjectFree', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.Obj = null;', ' };', @@ -15287,7 +15353,7 @@ begin ConvertProgram; CheckSource('TestClass_TObjectFree_VarArg', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.Obj = null;', ' };', @@ -15323,7 +15389,7 @@ begin ConvertProgram; CheckSource('TestClass_TObjectFreeNewInstance', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -15360,7 +15426,7 @@ begin ConvertProgram; CheckSource('TestClass_TObjectFreeLowerCase', LinesToStr([ // statements - 'rtl.createClass($mod, "tobject", null, function () {', + 'rtl.createClass(this, "tobject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -15448,13 +15514,13 @@ begin ConvertProgram; CheckSource('TestClass_ForIn', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TEnumerator", $mod.TObject, function () {', + 'rtl.createClass(this, "TEnumerator", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.FCurrent = null;', @@ -15468,7 +15534,7 @@ begin ' return Result;', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.GetEnumerator = function () {', ' var Result = null;', ' return Result;', @@ -15523,13 +15589,13 @@ begin ConvertProgram; CheckSource('TestClass_Message', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.recNewT($mod, "THopMsg", function () {', + 'rtl.recNewT(this, "THopMsg", function () {', ' this.DispInt = 0;', ' this.$eq = function (b) {', ' return this.DispInt === b.DispInt;', @@ -15539,7 +15605,7 @@ begin ' return this;', ' };', '});', - 'rtl.recNewT($mod, "TPutMsg", function () {', + 'rtl.recNewT(this, "TPutMsg", function () {', ' this.DispStr = "";', ' this.$eq = function (b) {', ' return this.DispStr === b.DispStr;', @@ -15549,7 +15615,7 @@ begin ' return this;', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.Run$1 = function (Msg) {', ' };', ' this.$msgint = {', @@ -15620,7 +15686,7 @@ begin ConvertProgram; CheckSource('TestClassOf_Create', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -15656,7 +15722,7 @@ begin ConvertProgram; CheckSource('TestClassOf_Call', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -15690,7 +15756,7 @@ begin ConvertProgram; CheckSource('TestClassOf_Assign', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.ClassType = null;', ' };', @@ -15727,13 +15793,13 @@ begin ConvertProgram; CheckSource('TestClassOf_Is', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TCar", $mod.TObject, function () {', + 'rtl.createClass(this, "TCar", this.TObject, function () {', '});', 'this.Obj = null;', 'this.C = null;', @@ -15773,7 +15839,7 @@ begin ConvertProgram; CheckSource('TestClassOf_Compare', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.ClassType = null;', ' };', @@ -15816,7 +15882,7 @@ begin ConvertProgram; CheckSource('TestClassOf_ClassVar', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.id = 0;', ' this.$init = function () {', ' };', @@ -15850,7 +15916,7 @@ begin ConvertProgram; CheckSource('TestClassOf_ClassMethod', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -15910,7 +15976,7 @@ begin ConvertProgram; CheckSource('TestClassOf_ClassProperty', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.FA = 0;', ' this.$init = function () {', ' };', @@ -15967,7 +16033,7 @@ begin ConvertProgram; CheckSource('TestClassOf_ClassMethodSelf', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.GlobalId = 0;', ' this.$init = function () {', ' };', @@ -16035,7 +16101,7 @@ begin ConvertProgram; CheckSource('TestClassOf_TypeCast', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -16045,14 +16111,14 @@ begin ' this.DoIt$1();', ' };', '});', - 'rtl.createClass($mod, "TMobile", $mod.TObject, function () {', + 'rtl.createClass(this, "TMobile", this.TObject, function () {', ' this.DoIt$1 = function () {', ' this.DoIt();', ' this.DoIt$1();', ' this.DoIt$2();', ' };', '});', - 'rtl.createClass($mod, "TCar", $mod.TMobile, function () {', + 'rtl.createClass(this, "TCar", this.TMobile, function () {', ' this.DoIt$2 = function () {', ' };', '});', @@ -16097,7 +16163,7 @@ begin ConvertProgram; CheckSource('TestClassOf_ImplicitFunctionCall', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -16143,16 +16209,16 @@ begin ConvertProgram; CheckSource('TestClassOf_Const', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "THawk", $mod.TObject, function () {', + 'rtl.createClass(this, "THawk", this.TObject, function () {', '});', - 'this.Hawk = $mod.THawk;', - 'this.DefaultBirdClasses = [$mod.TObject, $mod.THawk];', + 'this.Hawk = this.THawk;', + 'this.DefaultBirdClasses = [this.TObject, this.THawk];', '']), LinesToStr([ // $mod.$main ''])); @@ -16177,14 +16243,14 @@ begin ConvertProgram; CheckSource('TestNestedClass_Alias', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' $mod.$rtti.$inherited("TObject.TNested", rtl.longint, {});', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - '$mod.$rtti.$inherited("TAlias", $mod.$rtti["TObject.TNested"], {});', + 'this.$rtti.$inherited("TAlias", this.$rtti["TObject.TNested"], {});', 'this.i = 3;', 'this.j = 4;', '']), @@ -16222,7 +16288,7 @@ begin ConvertProgram; CheckSource('TestNestedClass_Record', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' rtl.recNewT(this, "TPoint", function () {', ' this.x = 0;', ' this.y = 0;', @@ -16248,7 +16314,7 @@ begin ' p.$assign(t);', ' };', '});', - 'this.p = $mod.TObject.TPoint.$clone({', + 'this.p = this.TObject.TPoint.$clone({', ' x: 2,', ' y: 4', '});', @@ -16304,13 +16370,13 @@ begin ConvertProgram; CheckSource('TestNestedClass_Class', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' rtl.createClass(this, "TLeg", $mod.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', @@ -16667,7 +16733,7 @@ begin ConvertProgram; CheckSource('TestExternalClass_NonExternalOverride', LinesToStr([ // statements - 'rtl.createClassExt($mod, "TExtC", ExtObjB, "", function () {', + 'rtl.createClassExt(this, "TExtC", ExtObjB, "", function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -16732,7 +16798,7 @@ begin ConvertProgram; CheckSource('TestExternalClass_SameNamePublishedProperty', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FSwiper = null;', ' };', @@ -16776,7 +16842,7 @@ begin ConvertProgram; CheckSource('TestExternalClass_NonExternalOverride', LinesToStr([ // statements - 'rtl.createClassExt($mod, "TExtB", ExtA, "", function () {', + 'rtl.createClassExt(this, "TExtB", ExtA, "", function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -16823,14 +16889,14 @@ begin ConvertProgram; CheckSource('TestExternalClass_PropertyDate', LinesToStr([ // statements - 'rtl.createClassExt($mod, "TExtB", ExtA, "", function () {', + 'rtl.createClassExt(this, "TExtB", ExtA, "", function () {', ' this.$init = function () {', ' this.FDate = "";', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FDate = "";', ' };', @@ -16889,7 +16955,7 @@ begin ConvertProgram; CheckSource('TestExternalClass_ClassProperty', LinesToStr([ // statements - 'rtl.createClassExt($mod, "TExtB", ExtA, "", function () {', + 'rtl.createClassExt(this, "TExtB", ExtA, "", function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -16951,7 +17017,7 @@ begin ConvertProgram; CheckSource('TestExternalClass_ClassOf', LinesToStr([ // statements - 'rtl.createClassExt($mod, "TExtC", ExtB, "", function () {', + 'rtl.createClassExt(this, "TExtC", ExtB, "", function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -17038,7 +17104,7 @@ begin ConvertProgram; CheckSource('TestExternalClass_Is', LinesToStr([ // statements - 'rtl.createClassExt($mod, "TExtC", ExtB, "", function () {', + 'rtl.createClassExt(this, "TExtC", ExtB, "", function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -17089,7 +17155,7 @@ begin ConvertProgram; CheckSource('TestExternalClass_Is', LinesToStr([ // statements - 'rtl.createClassExt($mod, "TExtC", ExtB, "", function () {', + 'rtl.createClassExt(this, "TExtC", ExtB, "", function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -17464,7 +17530,7 @@ begin ConvertProgram; CheckSource('TestExternalClass_ReintroduceOverload', LinesToStr([ // statements - 'rtl.createClassExt($mod, "TMyA", ExtA, "", function () {', + 'rtl.createClassExt(this, "TMyA", ExtA, "", function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -17510,7 +17576,7 @@ begin ConvertProgram; CheckSource('TestExternalClass_ReintroduceOverload', LinesToStr([ // statements - 'rtl.createClassExt($mod, "TMyC", ExtB, "", function () {', + 'rtl.createClassExt(this, "TMyC", ExtB, "", function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -17564,7 +17630,7 @@ begin ConvertProgram; CheckSource('TestExternalClass_NewInstance', LinesToStr([ // statements - 'rtl.createClassExt($mod, "TMyB", ExtA, "NewInstance", function () {', + 'rtl.createClassExt(this, "TMyB", ExtA, "NewInstance", function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -17679,7 +17745,7 @@ begin ConvertProgram; CheckSource('TestExternalClass_JSFunctionPasDescendant', LinesToStr([ // statements - 'rtl.createClassExt($mod, "TBird", ExtA, "", function () {', + 'rtl.createClassExt(this, "TBird", ExtA, "", function () {', ' this.Legs = 0;', ' this.$init = function () {', ' this.Size = 0;', @@ -17691,7 +17757,7 @@ begin ' return this;', ' };', '});', - 'rtl.createClassExt($mod, "TEagle", $mod.TBird, "", function () {', + 'rtl.createClassExt(this, "TEagle", this.TBird, "", function () {', ' this.Create$1 = function (b) {', ' $mod.TBird.Create.call(this, b);', ' return this;', @@ -17737,7 +17803,7 @@ begin ConvertProgram; CheckSource('TestExternalClass_PascalProperty', LinesToStr([ // statements - 'rtl.createClassExt($mod, "TControl", ExtA, "", function () {', + 'rtl.createClassExt(this, "TControl", ExtA, "", function () {', ' this.$init = function () {', ' this.FOnClick = null;', ' };', @@ -17797,14 +17863,14 @@ begin ConvertProgram; CheckSource('TestExternalClass_TypeCastToRootClass', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TChild", $mod.TObject, function () {', + 'rtl.createClass(this, "TChild", this.TObject, function () {', '});', 'this.Obj = null;', 'this.Child = null;', @@ -17867,17 +17933,17 @@ begin ConvertProgram; CheckSource('TestExternalClass_TypeCastToJSObject', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', - 'rtl.createInterface($mod, "IBird", "{4B0D080B-C0F6-396E-AE88-000B87785074}", [], $mod.IUnknown);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', + 'rtl.createInterface(this, "IBird", "{4B0D080B-C0F6-396E-AE88-000B87785074}", [], this.IUnknown);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TChild", $mod.TObject, function () {', + 'rtl.createClass(this, "TChild", this.TObject, function () {', '});', - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.$eq = function (b) {', ' return true;', ' };', @@ -17890,7 +17956,7 @@ begin 'this.i = null;', 'this.Bird = null;', 'this.j = null;', - 'this.r = $mod.TRec.$new();', + 'this.r = this.TRec.$new();', 'this.c = null;', '']), LinesToStr([ // $mod.$main @@ -17977,7 +18043,7 @@ begin ConvertProgram; CheckSource('TestExternalClass_TypeCastToJSFunction', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -17987,8 +18053,8 @@ begin ' function Sub() {', ' };', ' var f = null;', - ' f = $Self.DoIt;', - ' f = $Self.DoIt.bind(null, 13);', + ' f = this.DoIt;', + ' f = this.DoIt.bind(null, 13);', ' f = Sub;', ' f = $mod.GetIt;', ' };', @@ -18191,7 +18257,7 @@ begin ConvertProgram; CheckSource('TestExternalClass_BracketAccessor_Call', LinesToStr([ // statements - 'rtl.createClassExt($mod, "TMyArr", Array2, "", function () {', + 'rtl.createClassExt(this, "TMyArr", Array2, "", function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -18514,15 +18580,15 @@ begin ConvertProgram; CheckSource('TestClassInterface_Corba', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{00000000-0000-0000-C000-000000000046}", [], null);', - 'rtl.createInterface($mod, "IBird", "{5BD1A53B-69BB-37EE-AF32-BEFB86D85B03}", ["GetSize", "SetSize", "DoIt"], $mod.IUnknown);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{00000000-0000-0000-C000-000000000046}", [], null);', + 'rtl.createInterface(this, "IBird", "{5BD1A53B-69BB-37EE-AF32-BEFB86D85B03}", ["GetSize", "SetSize", "DoIt"], this.IUnknown);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' rtl.addIntf(this, $mod.IBird);', '});', 'this.BirdIntf = null;', @@ -18584,15 +18650,15 @@ begin ConvertProgram; CheckSource('TestClassInterface_Overloads', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{B92D5841-758A-322B-BDC4-8A2AE2C59400}", ["DoIt", "DoIt$1"], null);', - 'rtl.createInterface($mod, "IBird", "{8285DD5E-EA3E-396E-AE88-000B86AABF05}", ["DoIt$2"], $mod.IUnknown);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{B92D5841-758A-322B-BDC4-8A2AE2C59400}", ["DoIt", "DoIt$1"], null);', + 'rtl.createInterface(this, "IBird", "{8285DD5E-EA3E-396E-AE88-000B86AABF05}", ["DoIt$2"], this.IUnknown);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.DoIt = function (o) {', ' };', ' this.DoIt$1 = function (s) {', @@ -18681,9 +18747,9 @@ begin ConvertProgram; CheckSource('TestClassInterface_AncestorIntf', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{B92D5841-758A-322B-BDC4-8A2800000000}", ["DoIt"], null);', - 'rtl.createInterface($mod, "IBird", "{B92D5841-6264-3AE3-BF20-000000000000}", ["Fly"], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{B92D5841-758A-322B-BDC4-8A2800000000}", ["DoIt"], null);', + 'rtl.createInterface(this, "IBird", "{B92D5841-6264-3AE3-BF20-000000000000}", ["Fly"], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -18692,7 +18758,7 @@ begin ' };', ' rtl.addIntf(this, $mod.IUnknown);', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.Fly = function (i) {', ' };', ' rtl.addIntf(this, $mod.IBird);', @@ -18726,8 +18792,8 @@ begin ConvertProgram; CheckSource('TestClassInterface_ImplReintroduce', LinesToStr([ // statements - 'rtl.createInterface($mod, "IBird", "{B92D5841-6264-3AE2-8594-000000000000}", ["DoIt"], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IBird", "{B92D5841-6264-3AE2-8594-000000000000}", ["DoIt"], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -18735,7 +18801,7 @@ begin ' this.DoIt = function (i) {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.DoIt$1 = function (i) {', ' };', ' rtl.addIntf(this, $mod.IBird, {', @@ -18782,15 +18848,15 @@ begin ConvertProgram; CheckSource('TestClassInterface_MethodResolution', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{B92D5841-758A-322B-BDD7-23D600000000}", ["Walk"], null);', - 'rtl.createInterface($mod, "IBird", "{CF8A4986-80F6-396E-AE88-000B86AAE208}", ["Walk$1", "Fly"], $mod.IUnknown);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{B92D5841-758A-322B-BDD7-23D600000000}", ["Walk"], null);', + 'rtl.createInterface(this, "IBird", "{CF8A4986-80F6-396E-AE88-000B86AAE208}", ["Walk$1", "Fly"], this.IUnknown);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.Hop = function (i) {', ' };', ' this.Move = function (s) {', @@ -18835,10 +18901,10 @@ begin ConvertProgram; CheckSource('TestClassInterface_COM_AncestorLess', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{8F2D5841-758A-322B-BDDF-21CD521DD723}", ["_AddRef", "Walk"], null);', - 'rtl.createInterface($mod, "IBird", "{CCE11D4C-6504-3AEE-AE88-000B86AAE675}", [], $mod.IUnknown);', - 'rtl.createInterface($mod, "IDog", "{CCE11D4C-6504-3AEE-AE88-000B8E5FC675}", [], $mod.IUnknown);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{8F2D5841-758A-322B-BDDF-21CD521DD723}", ["_AddRef", "Walk"], null);', + 'rtl.createInterface(this, "IBird", "{CCE11D4C-6504-3AEE-AE88-000B86AAE675}", [], this.IUnknown);', + 'rtl.createInterface(this, "IDog", "{CCE11D4C-6504-3AEE-AE88-000B8E5FC675}", [], this.IUnknown);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -18846,7 +18912,7 @@ begin ' rtl.addIntf(this, $mod.IBird);', ' rtl.addIntf(this, $mod.IDog);', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' rtl.addIntf(this, $mod.IUnknown);', ' rtl.addIntf(this, $mod.IBird);', ' rtl.addIntf(this, $mod.IDog);', @@ -18886,25 +18952,25 @@ begin ConvertProgram; CheckSource('TestClassInterface_MethodOverride', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{D6D98E5B-8A10-4FEC-856A-7BFC847FE74B}", ["Go"], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{D6D98E5B-8A10-4FEC-856A-7BFC847FE74B}", ["Go"], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', ' rtl.addIntf(this, $mod.IUnknown);', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.Go = function () {', ' };', ' rtl.addIntf(this, $mod.IUnknown);', '});', - 'rtl.createClass($mod, "TCat", $mod.TObject, function () {', + 'rtl.createClass(this, "TCat", this.TObject, function () {', ' this.Go = function () {', ' };', ' rtl.addIntf(this, $mod.IUnknown);', '});', - 'rtl.createClass($mod, "TDog", $mod.TObject, function () {', + 'rtl.createClass(this, "TDog", this.TObject, function () {', ' this.Go = function () {', ' };', ' rtl.addIntf(this, $mod.IUnknown);', @@ -18949,26 +19015,26 @@ begin 'begin', '']); ConvertProgram; - CheckSource('TestClassInterface_Delegation', + CheckSource('TestClassInterface_Corba_Delegation', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', - 'rtl.createInterface($mod, "IBird", "{478D080B-C0F6-396E-AE88-000B87785B07}", ["Fly"], $mod.IUnknown);', - 'rtl.createInterface($mod, "IEagle", "{489289DE-FDE2-34A6-8288-39119022B1B4}", [], $mod.IBird);', - 'rtl.createInterface($mod, "IDove", "{489289DE-FDE2-34A6-8288-39118EF16074}", [], $mod.IBird);', - 'rtl.createInterface($mod, "ISwallow", "{B89289DE-FDE2-34A6-8288-3911CBDCB359}", [], $mod.IBird);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', + 'rtl.createInterface(this, "IBird", "{478D080B-C0F6-396E-AE88-000B87785B07}", ["Fly"], this.IUnknown);', + 'rtl.createInterface(this, "IEagle", "{489289DE-FDE2-34A6-8288-39119022B1B4}", [], this.IBird);', + 'rtl.createInterface(this, "IDove", "{489289DE-FDE2-34A6-8288-39118EF16074}", [], this.IBird);', + 'rtl.createInterface(this, "ISwallow", "{B89289DE-FDE2-34A6-8288-3911CBDCB359}", [], this.IBird);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' rtl.addIntf(this, $mod.IBird);', ' rtl.addIntf(this, $mod.IEagle);', ' rtl.addIntf(this, $mod.IDove);', ' rtl.addIntf(this, $mod.ISwallow);', '});', - 'rtl.createClass($mod, "TBat", $mod.TObject, function () {', + 'rtl.createClass(this, "TBat", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.FBirdIntf = null;', @@ -19036,26 +19102,26 @@ begin 'begin', '']); ConvertProgram; - CheckSource('TestClassInterface_DelegationStatic', + CheckSource('TestClassInterface_Corba_DelegationStatic', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', - 'rtl.createInterface($mod, "IBird", "{478D080B-C0F6-396E-AE88-000B87785B07}", ["Fly"], $mod.IUnknown);', - 'rtl.createInterface($mod, "IEagle", "{489289DE-FDE2-34A6-8288-39119022B1B4}", [], $mod.IBird);', - 'rtl.createInterface($mod, "IDove", "{489289DE-FDE2-34A6-8288-39118EF16074}", [], $mod.IBird);', - 'rtl.createInterface($mod, "ISwallow", "{B89289DE-FDE2-34A6-8288-3911CBDCB359}", [], $mod.IBird);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', + 'rtl.createInterface(this, "IBird", "{478D080B-C0F6-396E-AE88-000B87785B07}", ["Fly"], this.IUnknown);', + 'rtl.createInterface(this, "IEagle", "{489289DE-FDE2-34A6-8288-39119022B1B4}", [], this.IBird);', + 'rtl.createInterface(this, "IDove", "{489289DE-FDE2-34A6-8288-39118EF16074}", [], this.IBird);', + 'rtl.createInterface(this, "ISwallow", "{B89289DE-FDE2-34A6-8288-3911CBDCB359}", [], this.IBird);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' rtl.addIntf(this, $mod.IBird);', ' rtl.addIntf(this, $mod.IEagle);', ' rtl.addIntf(this, $mod.IDove);', ' rtl.addIntf(this, $mod.ISwallow);', '});', - 'rtl.createClass($mod, "TBat", $mod.TObject, function () {', + 'rtl.createClass(this, "TBat", this.TObject, function () {', ' this.FBirdIntf = null;', ' this.FDoveObj = null;', ' this.$intfmaps = {', @@ -19128,15 +19194,15 @@ begin ConvertProgram; CheckSource('TestClassInterface_Corba_Operators', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', - 'rtl.createInterface($mod, "IBird", "{D53FED90-DE59-3202-B1AE-000B87785B08}", ["GetItems", "SetItems"], $mod.IUnknown);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', + 'rtl.createInterface(this, "IBird", "{D53FED90-DE59-3202-B1AE-000B87785B08}", ["GetItems", "SetItems"], this.IUnknown);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' rtl.addIntf(this, $mod.IBird);', '});', 'this.IntfVar = null;', @@ -19203,15 +19269,15 @@ begin ConvertProgram; CheckSource('TestClassInterface_Corba_Args', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', - 'rtl.createInterface($mod, "IBird", "{4B0D080B-C0F6-396E-AE88-000B87785074}", [], $mod.IUnknown);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', + 'rtl.createInterface(this, "IBird", "{4B0D080B-C0F6-396E-AE88-000B87785074}", [], this.IUnknown);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' rtl.addIntf(this, $mod.IBird);', '});', 'this.DoIt = function (u, i, j) {', @@ -19297,16 +19363,16 @@ begin ConvertProgram; CheckSource('TestClassInterface_Corba_ForIn', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.Id = 0;', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createInterface($mod, "IEnumerator", "{95D7745D-ED61-3F13-BBE4-07708161999E}", ["GetCurrent", "MoveNext"], $mod.IUnknown);', - 'rtl.createInterface($mod, "IEnumerable", "{8CC9D45D-ED7D-3B73-96B6-290B931BB19E}", ["GetEnumerator"], $mod.IUnknown);', + 'rtl.createInterface(this, "IEnumerator", "{95D7745D-ED61-3F13-BBE4-07708161999E}", ["GetCurrent", "MoveNext"], this.IUnknown);', + 'rtl.createInterface(this, "IEnumerable", "{8CC9D45D-ED7D-3B73-96B6-290B931BB19E}", ["GetEnumerator"], this.IUnknown);', 'this.o = null;', 'this.i = null;', '']), @@ -19358,8 +19424,8 @@ begin ConvertProgram; CheckSource('TestClassInterface_COM_AssignVar', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -19416,8 +19482,8 @@ begin ConvertProgram; CheckSource('TestClassInterface_COM_AssignArg', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -19462,8 +19528,8 @@ begin ConvertProgram; CheckSource('TestClassInterface_COM_FunctionResult', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -19525,8 +19591,8 @@ begin ConvertProgram; CheckSource('TestClassInterface_COM_InheritedFuncResult', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -19537,7 +19603,7 @@ begin ' };', ' rtl.addIntf(this, $mod.IUnknown);', '});', - 'rtl.createClass($mod, "TMouse", $mod.TObject, function () {', + 'rtl.createClass(this, "TMouse", this.TObject, function () {', ' this.GetIntf = function () {', ' var Result = null;', ' var i = null;', @@ -19597,8 +19663,8 @@ begin ConvertProgram; CheckSource('TestClassInterface_COM_IsAsTypeCasts', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -19658,8 +19724,8 @@ begin ConvertProgram; CheckSource('TestClassInterface_COM_PassAsArg', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -19769,8 +19835,8 @@ begin ConvertProgram; CheckSource('TestClassInterface_COM_PassToUntypedParam', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -19868,8 +19934,8 @@ begin ConvertProgram; CheckSource('TestClassInterface_COM_FunctionInExpr', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -19955,8 +20021,8 @@ begin ConvertProgram; CheckSource('TestClassInterface_COM_Property', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FAnt = null;', ' };', @@ -20036,7 +20102,7 @@ begin ConvertProgram; CheckSource('TestClassInterface_COM_IntfProperty', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{385F5482-571B-338C-8130-4E97F330543B}", [', + 'rtl.createInterface(this, "IUnknown", "{385F5482-571B-338C-8130-4E97F330543B}", [', ' "_AddRef",', ' "_Release",', ' "GetBird",', @@ -20044,7 +20110,7 @@ begin ' "GetItems",', ' "SetItems"', '], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -20115,24 +20181,24 @@ begin ConvertProgram; CheckSource('TestClassInterface_COM_Delegation', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', - 'rtl.createInterface($mod, "IBird", "{CC440C7F-7623-3DEE-AE88-000B86AAF108}", ["Fly"], $mod.IUnknown);', - 'rtl.createInterface($mod, "IEagle", "{4B6A41C9-B020-3D7C-B688-96D19022B1B4}", [], $mod.IBird);', - 'rtl.createInterface($mod, "IDove", "{4B6A41C9-B020-3D7C-B688-96D18EF16074}", [], $mod.IBird);', - 'rtl.createInterface($mod, "ISwallow", "{BB6A41C9-B020-3D7C-B688-96D1CBDCB359}", [], $mod.IBird);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', + 'rtl.createInterface(this, "IBird", "{CC440C7F-7623-3DEE-AE88-000B86AAF108}", ["Fly"], this.IUnknown);', + 'rtl.createInterface(this, "IEagle", "{4B6A41C9-B020-3D7C-B688-96D19022B1B4}", [], this.IBird);', + 'rtl.createInterface(this, "IDove", "{4B6A41C9-B020-3D7C-B688-96D18EF16074}", [], this.IBird);', + 'rtl.createInterface(this, "ISwallow", "{BB6A41C9-B020-3D7C-B688-96D1CBDCB359}", [], this.IBird);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' rtl.addIntf(this, $mod.IBird);', ' rtl.addIntf(this, $mod.IEagle);', ' rtl.addIntf(this, $mod.IDove);', ' rtl.addIntf(this, $mod.ISwallow);', '});', - 'rtl.createClass($mod, "TBat", $mod.TObject, function () {', + 'rtl.createClass(this, "TBat", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.FBirdIntf = null;', @@ -20195,8 +20261,8 @@ begin ConvertProgram; CheckSource('TestClassInterface_COM_With', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{D7ADB00D-C6B6-39FB-BDDF-21CD521DDFA9}", ["_AddRef", "_Release", "GetAnt"], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{D7ADB00D-C6B6-39FB-BDDF-21CD521DDFA9}", ["_AddRef", "_Release", "GetAnt"], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -20247,16 +20313,16 @@ begin ConvertProgram; CheckSource('TestClassInterface_COM_ForIn', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{B92D5841-758A-322B-B800-000000000000}", [], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.Id = 0;', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createInterface($mod, "IEnumerator", "{95D7745D-ED61-3F13-BBE4-07708161999E}", ["GetCurrent", "MoveNext"], $mod.IUnknown);', - 'rtl.createInterface($mod, "IEnumerable", "{8CC9D45D-ED7D-3B73-96B6-290B931BB19E}", ["GetEnumerator"], $mod.IUnknown);', + 'rtl.createInterface(this, "IEnumerator", "{95D7745D-ED61-3F13-BBE4-07708161999E}", ["GetCurrent", "MoveNext"], this.IUnknown);', + 'rtl.createInterface(this, "IEnumerable", "{8CC9D45D-ED7D-3B73-96B6-290B931BB19E}", ["GetEnumerator"], this.IUnknown);', 'this.o = null;', 'this.i = null;', '']), @@ -20423,14 +20489,14 @@ begin ConvertProgram; CheckSource('TestClassInterface_GUID', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{F31DB68F-3010-D355-4EBA-CDD4EF4A737C}", [], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{F31DB68F-3010-D355-4EBA-CDD4EF4A737C}", [], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.recNewT($mod, "TGUID", function () {', + 'rtl.recNewT(this, "TGUID", function () {', ' this.D1 = 0;', ' this.D2 = 0;', ' this.D3 = 0;', @@ -20453,7 +20519,7 @@ begin 'this.DoStr = function (s) {', '};', 'this.i = null;', - 'this.g = $mod.TGUID.$clone({', + 'this.g = this.TGUID.$clone({', ' D1: 0xD91C9AF4,', ' D2: 0x3C93,', ' D3: 0x420F,', @@ -20544,8 +20610,8 @@ begin ConvertProgram; CheckSource('TestClassInterface_GUIDProperty', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{F31DB68F-3010-D355-4EBA-CDD4EF4A737C}", [], null);', - 'rtl.recNewT($mod, "TGUID", function () {', + 'rtl.createInterface(this, "IUnknown", "{F31DB68F-3010-D355-4EBA-CDD4EF4A737C}", [], null);', + 'rtl.recNewT(this, "TGUID", function () {', ' this.D1 = 0;', ' this.D2 = 0;', ' this.D3 = 0;', @@ -20561,7 +20627,7 @@ begin ' return this;', ' };', '});', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -20642,13 +20708,13 @@ begin ConvertProgram; CheckSource('TestClassHelper_ClassVar', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.One = 1;', ' this.Two = 2;', ' this.Glob = 0;', @@ -20718,14 +20784,14 @@ begin ConvertProgram; CheckSource('TestClassHelper_Method_AccessInstanceFields', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FSize = 0;', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Foo = function (w) {', ' var Result = 0;', ' Result = this.FSize;', @@ -20802,7 +20868,7 @@ begin ConvertProgram; CheckSource('TestClassHelper_Method_Call', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -20821,7 +20887,7 @@ begin ' $mod.THelper.Foo.call(o, 5);', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Foo = function (w) {', ' var Result = 0;', ' this.Run(10);', @@ -20898,7 +20964,7 @@ begin ConvertProgram; CheckSource('TestClassHelper_Method_Nested_Call', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -20915,7 +20981,7 @@ begin ' };', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Foo = function (w) {', ' var $Self = this;', ' var Result = 0;', @@ -20991,7 +21057,7 @@ begin ConvertProgram; CheckSource('TestClassHelper_ClassMethod_Call', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -21005,7 +21071,7 @@ begin ' $mod.THelper.Foo.call(this, 1);', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Foo = function (w) {', ' var Result = 0;', ' this.Run(10);', @@ -21062,13 +21128,13 @@ begin ConvertProgram; CheckSource('TestClassHelper_ClassOf', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Foo = function (w) {', ' var Result = 0;', ' return Result;', @@ -21157,7 +21223,7 @@ begin ConvertProgram; CheckSource('TestClassHelper_MethodRefObjFPC', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -21174,7 +21240,7 @@ begin ' $mod.r = $mod.THelper.Run;', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Fly = function (w) {', ' $mod.f = rtl.createCallback(this, $mod.THelper.Fly);', ' $mod.g = rtl.createCallback(this.$class, $mod.THelper.Glide);', @@ -21250,7 +21316,7 @@ begin ConvertProgram; CheckSource('TestClassHelper_Constructor', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -21262,7 +21328,7 @@ begin ' return this;', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.NewHlp = function (w) {', ' this.Create();', ' $mod.TObject.$create("Create");', @@ -21347,7 +21413,7 @@ begin ConvertProgram; CheckSource('TestClassHelper_InheritedObjFPC', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -21355,19 +21421,19 @@ begin ' this.Fly = function () {', ' };', '});', - 'rtl.createHelper($mod, "TObjHelper", null, function () {', + 'rtl.createHelper(this, "TObjHelper", null, function () {', ' this.Fly = function () {', ' $mod.TObject.Fly.call(this);', ' $mod.TObject.Fly.call(this);', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.Fly$1 = function () {', ' $mod.TObjHelper.Fly.call(this);', ' $mod.TObjHelper.Fly.call(this);', ' };', '});', - 'rtl.createHelper($mod, "TBirdHelper", null, function () {', + 'rtl.createHelper(this, "TBirdHelper", null, function () {', ' this.Fly = function () {', ' $mod.TBird.Fly$1.call(this);', ' $mod.TBird.Fly$1.call(this);', @@ -21375,7 +21441,7 @@ begin ' this.Walk = function (w) {', ' };', '});', - 'rtl.createHelper($mod, "TEagleHelper", $mod.TBirdHelper, function () {', + 'rtl.createHelper(this, "TEagleHelper", this.TBirdHelper, function () {', ' this.Fly$1 = function () {', ' $mod.TBird.Fly$1.call(this);', ' $mod.TBird.Fly$1.call(this);', @@ -21472,7 +21538,7 @@ begin ConvertProgram; CheckSource('TestClassHelper_Property', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FSize = 0;', ' };', @@ -21496,7 +21562,7 @@ begin ' this.SetSpeed = function (Value) {', ' };', '});', - 'rtl.createHelper($mod, "TObjHelper", null, function () {', + 'rtl.createHelper(this, "TObjHelper", null, function () {', ' this.GetLeft = function () {', ' var Result = 0;', ' this.FSize = this.FSize + 11;', @@ -21513,7 +21579,7 @@ begin ' this.SetLeft = function (Value) {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.DoIt = function () {', ' $mod.TObjHelper.SetLeft.call(this, $mod.TObjHelper.GetLeft.call(this) + 11);', ' $mod.TObjHelper.SetLeft.call(this, $mod.TObjHelper.GetLeft.call(this) + 21);', @@ -21604,7 +21670,7 @@ begin ConvertProgram; CheckSource('TestClassHelper_Property_Array', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -21623,7 +21689,7 @@ begin ' this.SetSpeed = function (Index, Value) {', ' };', '});', - 'rtl.createHelper($mod, "TObjHelper", null, function () {', + 'rtl.createHelper(this, "TObjHelper", null, function () {', ' this.GetSize = function (Index) {', ' var Result = 0;', ' $mod.TObjHelper.SetSize.call(this, true, $mod.TObjHelper.GetSize.call(this, false) + 11);', @@ -21637,7 +21703,7 @@ begin ' this.SetSize = function (Index, Value) {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.DoIt = function () {', ' $mod.TObjHelper.SetSize.call(this, true, $mod.TObjHelper.GetSize.call(this, false) + 11);', ' $mod.TObjHelper.SetSize.call(this, true, $mod.TObjHelper.GetSize.call(this, false) + 21);', @@ -21700,7 +21766,7 @@ begin ConvertProgram; CheckSource('TestClassHelper_Property_Array_Default', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -21713,11 +21779,11 @@ begin ' this.SetSpeed = function (Index, Value) {', ' };', '});', - 'rtl.createHelper($mod, "TObjHelper", null, function () {', + 'rtl.createHelper(this, "TObjHelper", null, function () {', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', '});', - 'rtl.createHelper($mod, "TBirdHelper", null, function () {', + 'rtl.createHelper(this, "TBirdHelper", null, function () {', ' this.GetSize = function (Index) {', ' var Result = false;', ' $mod.TBirdHelper.SetSize.call(this, 1, !$mod.TBirdHelper.GetSize.call(this, 2));', @@ -21762,13 +21828,13 @@ begin ConvertProgram; CheckSource('TestClassHelper_Property_Array_DefaultDefault', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createHelper($mod, "TObjHelper", null, function () {', + 'rtl.createHelper(this, "TObjHelper", null, function () {', ' this.GetItems = function (Index) {', ' var Result = null;', ' $mod.TObjHelper.SetItems.call($mod.TObjHelper.GetItems.call(this, 1), 2, $mod.TObjHelper.GetItems.call($mod.TObjHelper.GetItems.call(this, 3), 4));', @@ -21881,7 +21947,7 @@ begin ConvertProgram; CheckSource('TestClassHelper_ClassProperty', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.FSize = 0;', ' this.$init = function () {', ' };', @@ -21901,7 +21967,7 @@ begin ' return Result;', ' };', '});', - 'rtl.createHelper($mod, "TObjHelper", null, function () {', + 'rtl.createHelper(this, "TObjHelper", null, function () {', ' this.GetLeft = function () {', ' var Result = 0;', ' $mod.TObject.FSize = this.FSize + 11;', @@ -21918,7 +21984,7 @@ begin ' this.SetLeft = function (Value) {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.DoIt = function () {', ' $mod.TObjHelper.SetLeft.call(this, $mod.TObjHelper.GetLeft.call(this) + 11);', ' $mod.TObjHelper.SetLeft.call(this, $mod.TObjHelper.GetLeft.call(this) + 21);', @@ -22046,7 +22112,7 @@ begin ConvertProgram; CheckSource('TestClassHelper_ClassPropertyStatic', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -22060,7 +22126,7 @@ begin ' this.SetSpeed = function (Value) {', ' };', '});', - 'rtl.createHelper($mod, "TObjHelper", null, function () {', + 'rtl.createHelper(this, "TObjHelper", null, function () {', ' this.GetLeft = function () {', ' var Result = 0;', ' $mod.TObject.SetSpeed($mod.TObject.GetSpeed() + 12);', @@ -22070,7 +22136,7 @@ begin ' this.SetLeft = function (Value) {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.DoIt = function () {', ' $mod.TObjHelper.SetLeft($mod.TObjHelper.GetLeft() + 11);', ' };', @@ -22197,7 +22263,7 @@ begin ConvertProgram; CheckSource('TestClassHelper_ClassProperty_Array', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -22213,7 +22279,7 @@ begin ' return Result;', ' };', '});', - 'rtl.createHelper($mod, "TObjHelper", null, function () {', + 'rtl.createHelper(this, "TObjHelper", null, function () {', ' this.GetSize = function (Index) {', ' var Result = 0;', ' $mod.TObjHelper.SetSize.call(this, true, $mod.TObjHelper.GetSize.call(this, false) + 11);', @@ -22227,7 +22293,7 @@ begin ' this.SetSize = function (Index, Value) {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.DoIt = function () {', ' $mod.TObjHelper.SetSize.call(this, true, $mod.TObjHelper.GetSize.call(this, false) + 11);', ' $mod.TObjHelper.SetSize.call(this, true, $mod.TObjHelper.GetSize.call(this, false) + 21);', @@ -22293,13 +22359,13 @@ begin ConvertProgram; CheckSource('TestClassHelper_ForIn', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TEnumerator", $mod.TObject, function () {', + 'rtl.createClass(this, "TEnumerator", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.FCurrent = null;', @@ -22313,9 +22379,9 @@ begin ' return Result;', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', '});', - 'rtl.createHelper($mod, "TBirdHelper", null, function () {', + 'rtl.createHelper(this, "TBirdHelper", null, function () {', ' this.GetEnumerator = function () {', ' var Result = null;', ' return Result;', @@ -22389,7 +22455,7 @@ begin ConvertProgram; CheckSource('TestClassHelper_PassProperty', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FField = null;', ' };', @@ -22397,7 +22463,7 @@ begin ' this.FField = undefined;', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Fly = function () {', ' $mod.THelper.Fly.call(this.FField);', ' $mod.THelper.Run.call(this.FField.$class);', @@ -22479,7 +22545,7 @@ begin ConvertProgram; CheckSource('TestExtClassHelper_ClassVar', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.One = 1;', ' this.Two = 2;', ' this.Glob = 0;', @@ -22572,7 +22638,7 @@ begin ConvertProgram; CheckSource('TestExtClassHelper_Method_Call', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Foo = function (w) {', ' var Result = 0;', ' this.Run(10);', @@ -22685,7 +22751,7 @@ begin ConvertProgram; CheckSource('TestRecordHelper_ClassVar', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.$eq = function (b) {', ' return true;', ' };', @@ -22693,7 +22759,7 @@ begin ' return this;', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.One = 1;', ' this.Two = 2;', ' this.Glob = 0;', @@ -22716,7 +22782,7 @@ begin ' return Result;', ' };', '});', - 'this.r = $mod.TRec.$new();', + 'this.r = this.TRec.$new();', '']), LinesToStr([ // $mod.$main '$mod.THelper.Two = 1;', @@ -22789,7 +22855,7 @@ begin ConvertProgram; CheckSource('TestRecordHelper_Method_Call', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.$eq = function (b) {', ' return true;', ' };', @@ -22808,7 +22874,7 @@ begin ' $mod.THelper.Foo.call(this, 4);', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Foo = function (w) {', ' var Result = 0;', ' this.Run(10);', @@ -22826,7 +22892,7 @@ begin ' return Result;', ' };', '});', - 'this.Rec = $mod.TRec.$new();', + 'this.Rec = this.TRec.$new();', '']), LinesToStr([ // $mod.$main '$mod.THelper.Foo.call($mod.Rec, 1);', @@ -22874,7 +22940,7 @@ begin ConvertProgram; CheckSource('TestRecordHelper_Constructor', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.$eq = function (b) {', ' return true;', ' };', @@ -22887,7 +22953,7 @@ begin ' return this;', ' };', '}, true);', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.NewHlp = function (w) {', ' this.Create(2);', ' $mod.TRec.$new().Create(3);', @@ -22899,7 +22965,7 @@ begin ' return this[fn].apply($mod.TRec.$new(), args);', ' };', '});', - 'this.Rec = $mod.TRec.$new();', + 'this.Rec = this.TRec.$new();', '']), LinesToStr([ // $mod.$main '$mod.THelper.NewHlp.call($mod.Rec, 2);', @@ -22959,7 +23025,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_ClassVar', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.One = 1;', ' this.Two = 2;', ' this.Glob = 0;', @@ -23031,7 +23097,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_PassResultElement', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.DoIt = function (e) {', ' };', ' this.DoSome = function (e) {', @@ -23114,7 +23180,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_PassArgs', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.DoIt = function (e) {', ' };', '});', @@ -23191,7 +23257,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_PassVarConst', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.DoIt = function (e) {', ' };', '});', @@ -23280,7 +23346,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_PassFuncResult', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.DoIt = function (e) {', ' };', '});', @@ -23382,7 +23448,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_PassPropertyField', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FField = 0;', ' };', @@ -23431,7 +23497,7 @@ begin ' $mod.THelper.Run();', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Fly = function () {', ' };', ' this.Run = function () {', @@ -23527,7 +23593,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_PassPropertyGetter', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FField = 0;', ' };', @@ -23578,7 +23644,7 @@ begin ' return Result;', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Fly = function () {', ' };', ' this.Run = function () {', @@ -23661,7 +23727,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_PassClassPropertyField', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.FField = 0;', ' this.$init = function () {', ' };', @@ -23734,7 +23800,7 @@ begin ' }, 7);', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Fly = function (n) {', ' };', '});', @@ -23834,7 +23900,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_PassClassPropertyGetterStatic', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.FField = 0;', ' this.$init = function () {', ' };', @@ -23882,7 +23948,7 @@ begin ' return Result;', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Fly = function (n) {', ' };', '});', @@ -23959,7 +24025,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_PassClassPropertyGetterNonStatic', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.FField = 0;', ' this.$init = function () {', ' };', @@ -24006,7 +24072,7 @@ begin ' return Result;', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Fly = function (n) {', ' };', '});', @@ -24110,7 +24176,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_Property', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.GetSize = function () {', ' var Result = 0;', ' Result = $mod.THelper.GetSize.call(this) + 1;', @@ -24205,7 +24271,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_Property_Array', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.GetItems = function (Index) {', ' var Result = false;', ' Result = $mod.THelper.GetItems.call(this, 1);', @@ -24286,7 +24352,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_ClassProperty', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.GetSize = function () {', ' var Result = 0;', ' Result = $mod.THelper.GetSize() + 1;', @@ -24334,7 +24400,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_ClassProperty_Array', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.GetItems = function (Index) {', ' var Result = false;', ' Result = $mod.THelper.GetItems(1);', @@ -24378,7 +24444,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_ClassMethod', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.DoStatic = function () {', ' $mod.THelper.DoStatic();', ' $mod.THelper.DoStatic();', @@ -24433,7 +24499,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_Constructor', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Init = function (e) {', ' this.set(e);', ' $mod.THelper.Init.call(this, e + 1);', @@ -24498,7 +24564,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_Word', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.DoIt = function (e) {', ' this.set(e);', ' this.set(this.get() + 1);', @@ -24542,7 +24608,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_Boolean', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Run = function (e) {', ' this.set(e);', ' this.set(!this.get());', @@ -24588,7 +24654,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_WordBool', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Run = function (e) {', ' var i = 0;', ' i = (this.get() ? 1 : 0);', @@ -24645,7 +24711,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_Double', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.NPI = 3.141592;', ' this.ToStr = function () {', ' var Result = "";', @@ -24731,14 +24797,14 @@ begin ConvertProgram; CheckSource('TestTypeHelper_NativeInt', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelperI", null, function () {', + 'rtl.createHelper(this, "THelperI", null, function () {', ' this.ToStr = function () {', ' var Result = "";', ' Result = "" + this.get();', ' return Result;', ' };', '});', - 'rtl.createHelper($mod, "THelperU", null, function () {', + 'rtl.createHelper(this, "THelperU", null, function () {', ' this.ToStr = function () {', ' var Result = "";', ' Result = "" + this.get();', @@ -24818,13 +24884,13 @@ begin ConvertProgram; CheckSource('TestTypeHelper_StringChar', LinesToStr([ // statements - 'rtl.createHelper($mod, "TStringHelper", null, function () {', + 'rtl.createHelper(this, "TStringHelper", null, function () {', ' this.DoIt = function (e) {', ' this.set(rtl.setCharAt(this.get(), 0, "c"));', ' this.set(rtl.setCharAt(this.get(), 1, this.get().charAt(2)));', ' };', '});', - 'rtl.createHelper($mod, "TCharHelper", null, function () {', + 'rtl.createHelper(this, "TCharHelper", null, function () {', ' this.Fly = function () {', ' this.set("c");', ' };', @@ -24882,7 +24948,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_JSValue', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.ToStr = function () {', ' var Result = "";', ' return Result;', @@ -24949,7 +25015,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_Array', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.DoIt = function (e) {', ' this.get()[1] = true;', ' this.get()[2] = !this.get()[3];', @@ -25018,7 +25084,7 @@ begin ' "1": "blue",', ' blue: 1', '};', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.DoIt = function (e) {', ' this.set($mod.TEnum.red);', ' this.set(this.get() + 1);', @@ -25116,7 +25182,7 @@ begin ' "1": "blue",', ' blue: 1', '};', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.DoIt = function (e) {', ' this.set({});', ' this.set(rtl.createSet($mod.TEnum.red));', @@ -25219,15 +25285,15 @@ begin ConvertProgram; CheckSource('TestTypeHelper_InterfaceType', LinesToStr([ // statements - 'rtl.createInterface($mod, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createInterface(this, "IUnknown", "{D7ADB0E1-758A-322B-BDDF-21CD521DDFA9}", ["_AddRef", "_Release"], null);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', ' rtl.addIntf(this, $mod.IUnknown);', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Fly = function (e) {', ' var $ir = rtl.createIntfRefs();', ' try {', @@ -25318,7 +25384,7 @@ begin ConvertProgram; CheckSource('TestTypeHelper_NestedSelf', LinesToStr([ // statements - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.Run = function (Value) {', ' var $Self = this;', ' function Sub(i) {', @@ -25774,7 +25840,7 @@ begin ConvertProgram; CheckSource('TestProcType_MethodFPC', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -25831,7 +25897,7 @@ begin ConvertProgram; CheckSource('TestProcType_MethodDelphi', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -25925,7 +25991,7 @@ begin ConvertProgram; CheckSource('TestProcType_PropertyFPC', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FOnFoo = null;', ' };', @@ -26067,7 +26133,7 @@ begin ConvertProgram; CheckSource('TestProcType_PropertyDelphi', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FOnFoo = null;', ' };', @@ -26193,7 +26259,7 @@ begin ConvertProgram; CheckSource('TestProcType_WithClassInstDoPropertyFPC', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FOnFoo = null;', ' };', @@ -26361,7 +26427,7 @@ begin ConvertProgram; CheckSource('TestProcType_Nested', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -26477,7 +26543,7 @@ begin ConvertProgram; CheckSource('TestProcType_ReferenceToMethod', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -26869,7 +26935,7 @@ begin ConvertProgram; CheckSource('TestPointer', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -26921,7 +26987,7 @@ begin ConvertProgram; CheckSource('TestPointer_Proc', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -27121,7 +27187,7 @@ begin ConvertProgram; CheckSource('TestPointer_Record', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.x = 0;', ' this.$eq = function (b) {', ' return this.x === b.x;', @@ -27131,7 +27197,7 @@ begin ' return this;', ' };', '});', - 'this.r = $mod.TRec.$new();', + 'this.r = this.TRec.$new();', 'this.p = null;', 'this.q = null;', 'this.Ptr = null;', @@ -27184,9 +27250,9 @@ begin ' DoIt(@r,p,p);', '']); ConvertProgram; - CheckSource('TestPointer_Record', + CheckSource('TestPointer_RecordArg', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.x = 0;', ' this.$eq = function (b) {', ' return this.x === b.x;', @@ -27210,7 +27276,7 @@ begin ' p.x = p.x;', ' return Result;', '};', - 'this.r = $mod.TRec.$new();', + 'this.r = this.TRec.$new();', 'this.p = null;', '']), LinesToStr([ // $mod.$main @@ -27380,7 +27446,7 @@ begin ConvertProgram; CheckSource('TestJSValue_TypecastToJSValue', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.$eq = function (b) {', ' return true;', ' };', @@ -27391,7 +27457,7 @@ begin 'this.Fly = function (v) {', '};', 'this.a = [];', - 'this.r = $mod.TRec.$new();', + 'this.r = this.TRec.$new();', 'this.s = {};', '']), LinesToStr([ // $mod.$main @@ -27608,7 +27674,7 @@ begin ConvertProgram; CheckSource('TestJSValue_ClassInstance', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -27652,13 +27718,13 @@ begin ConvertProgram; CheckSource('TestJSValue_ClassOf', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', '});', 'this.v = undefined;', 'this.c = null;', @@ -27764,7 +27830,7 @@ begin ' "1": "small",', ' small: 1', '};', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -27994,7 +28060,7 @@ begin ConvertProgram; CheckSource('TestJSValue_ProcType_Assign', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -28073,7 +28139,7 @@ begin ConvertProgram; CheckSource('TestJSValue_ProcType_Equal', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -28468,7 +28534,7 @@ begin ConvertProgram; CheckSource('TestJSValue_OverloadPointer', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -28531,12 +28597,12 @@ begin ConvertProgram; CheckSource('TestRTTI_IntRange', LinesToStr([ // statements - '$mod.$rtti.$Int("TGraphicsColor", {', + 'this.$rtti.$Int("TGraphicsColor", {', ' minvalue: -2147483648,', ' maxvalue: 2147483647,', ' ordtype: 4', '});', - '$mod.$rtti.$inherited("TColor", $mod.$rtti["TGraphicsColor"], {});', + 'this.$rtti.$inherited("TColor", this.$rtti["TGraphicsColor"], {});', 'this.p = null;', 'this.k = 0;', '']), @@ -28565,7 +28631,7 @@ begin ConvertProgram; CheckSource('TestRTTI_Double', LinesToStr([ // statements - '$mod.$rtti.$inherited("TFloat", rtl.double, {});', + 'this.$rtti.$inherited("TFloat", rtl.double, {});', 'this.p = null;', '']), LinesToStr([ // $mod.$main @@ -28591,24 +28657,24 @@ begin ConvertProgram; CheckSource('TestRTTI_ProcType', LinesToStr([ // statements - '$mod.$rtti.$ProcVar("TProcA", {', + 'this.$rtti.$ProcVar("TProcA", {', ' procsig: rtl.newTIProcSig(null)', '});', - '$mod.$rtti.$MethodVar("TMethodB", {', + 'this.$rtti.$MethodVar("TMethodB", {', ' procsig: rtl.newTIProcSig(null),', ' methodkind: 0', '});', - '$mod.$rtti.$ProcVar("TProcC", {', + 'this.$rtti.$ProcVar("TProcC", {', ' procsig: rtl.newTIProcSig(null, 2)', '});', - '$mod.$rtti.$ProcVar("TProcD", {', + 'this.$rtti.$ProcVar("TProcD", {', ' procsig: rtl.newTIProcSig([["i", rtl.longint], ["j", rtl.string, 2], ["c", rtl.char, 1], ["d", rtl.double, 4]])', '});', - '$mod.$rtti.$ProcVar("TProcE", {', + 'this.$rtti.$ProcVar("TProcE", {', ' procsig: rtl.newTIProcSig(null, rtl.nativeint)', '});', - '$mod.$rtti.$ProcVar("TProcF", {', - ' procsig: rtl.newTIProcSig([["p", $mod.$rtti["TProcA"], 2]], rtl.nativeuint)', + 'this.$rtti.$ProcVar("TProcF", {', + ' procsig: rtl.newTIProcSig([["p", this.$rtti["TProcA"], 2]], rtl.nativeuint)', '});', 'this.p = null;', '']), @@ -28643,7 +28709,7 @@ begin CheckSource('TestRTTI_ProcType_ArgFromOtherUnit', LinesToStr([ // statements 'var $impl = $mod.$impl;', - '$mod.$rtti.$ProcVar("TProcA", {', + 'this.$rtti.$ProcVar("TProcA", {', ' procsig: rtl.newTIProcSig([["o", pas.unit2.$rtti["TObject"]]], pas.unit2.$rtti["TObject"])', '});', '']), @@ -28680,17 +28746,17 @@ begin ' "1": "dark",', ' dark: 1', '};', - '$mod.$rtti.$Enum("TFlag", {', + 'this.$rtti.$Enum("TFlag", {', ' minvalue: 0,', ' maxvalue: 1,', ' ordtype: 1,', ' enumtype: this.TFlag', '});', - '$mod.$rtti.$Set("TFlags", {', - ' comptype: $mod.$rtti["TFlag"]', + 'this.$rtti.$Set("TFlags", {', + ' comptype: this.$rtti["TFlag"]', '});', - '$mod.$rtti.$ProcVar("TProc", {', - ' procsig: rtl.newTIProcSig([["f", $mod.$rtti["TFlags"]]], $mod.$rtti["TFlag"])', + 'this.$rtti.$ProcVar("TProc", {', + ' procsig: rtl.newTIProcSig([["f", this.$rtti["TFlags"]]], this.$rtti["TFlag"])', '});', 'this.p = null;', '']), @@ -28736,14 +28802,14 @@ begin ' "1": "green",', ' green: 1', '};', - '$mod.$rtti.$Enum("TFlags$a", {', + 'this.$rtti.$Enum("TFlags$a", {', ' minvalue: 0,', ' maxvalue: 1,', ' ordtype: 1,', ' enumtype: this.TFlags$a', '});', - '$mod.$rtti.$Set("TFlags", {', - ' comptype: $mod.$rtti["TFlags$a"]', + 'this.$rtti.$Set("TFlags", {', + ' comptype: this.$rtti["TFlags$a"]', '});', 'this.f = {};', '']), @@ -28775,26 +28841,26 @@ begin ' "1": "dark",', ' dark: 1', '};', - '$mod.$rtti.$Enum("TFlag", {', + 'this.$rtti.$Enum("TFlag", {', ' minvalue: 0,', ' maxvalue: 1,', ' ordtype: 1,', ' enumtype: this.TFlag', '});', - '$mod.$rtti.$StaticArray("TFlagNames", {', + 'this.$rtti.$StaticArray("TFlagNames", {', ' dims: [2],', ' eltype: rtl.string', '});', - '$mod.$rtti.$StaticArray("TBoolNames", {', + 'this.$rtti.$StaticArray("TBoolNames", {', ' dims: [2],', ' eltype: rtl.string', '});', - '$mod.$rtti.$StaticArray("TByteArray", {', + 'this.$rtti.$StaticArray("TByteArray", {', ' dims: [32768],', ' eltype: rtl.byte', '});', - '$mod.$rtti.$ProcVar("TProc", {', - ' procsig: rtl.newTIProcSig([["f", $mod.$rtti["TBoolNames"]]], $mod.$rtti["TFlagNames"])', + 'this.$rtti.$ProcVar("TProc", {', + ' procsig: rtl.newTIProcSig([["f", this.$rtti["TBoolNames"]]], this.$rtti["TFlagNames"])', '});', 'this.p = null;', '']), @@ -28819,14 +28885,14 @@ begin ConvertProgram; CheckSource('TestRTTI_DynArray', LinesToStr([ // statements - '$mod.$rtti.$DynArray("TArrStr", {', + 'this.$rtti.$DynArray("TArrStr", {', ' eltype: rtl.string', '});', - '$mod.$rtti.$DynArray("TArr2Dim", {', - ' eltype: $mod.$rtti["TArrStr"]', + 'this.$rtti.$DynArray("TArr2Dim", {', + ' eltype: this.$rtti["TArrStr"]', '});', - '$mod.$rtti.$ProcVar("TProc", {', - ' procsig: rtl.newTIProcSig([["f", $mod.$rtti["TArrStr"]]], $mod.$rtti["TArr2Dim"])', + 'this.$rtti.$ProcVar("TProc", {', + ' procsig: rtl.newTIProcSig([["f", this.$rtti["TArrStr"]]], this.$rtti["TArr2Dim"])', '});', 'this.p = null;', '']), @@ -28847,11 +28913,11 @@ begin ConvertProgram; CheckSource('TestRTTI_ArrayNestedAnonymous', LinesToStr([ // statements - '$mod.$rtti.$DynArray("TArr$a", {', + 'this.$rtti.$DynArray("TArr$a", {', ' eltype: rtl.longint', '});', - '$mod.$rtti.$DynArray("TArr", {', - ' eltype: $mod.$rtti["TArr$a"]', + 'this.$rtti.$DynArray("TArr", {', + ' eltype: this.$rtti["TArr$a"]', '});', 'this.a = [];', '']), @@ -28969,7 +29035,7 @@ begin ConvertProgram; CheckSource('TestRTTI_Class_Field', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FPropA = "";', ' this.VarLI = 0;', @@ -29035,7 +29101,7 @@ begin ConvertProgram; CheckSource('TestRTTI_Class_Method', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -29068,7 +29134,7 @@ begin ConvertProgram; CheckSource('TestRTTI_Class_MethodOpenArray', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -29114,7 +29180,7 @@ begin ConvertProgram; CheckSource('TestRTTI_Class_Property', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FColor = 0;', ' this.FColorStored = false;', @@ -29183,7 +29249,7 @@ begin ConvertProgram; CheckSource('TestRTTI_Class_PropertyParams', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -29225,8 +29291,8 @@ begin ConvertProgram; CheckSource('TestRTTI_Class_OtherUnit_TypeAlias', LinesToStr([ // statements - '$mod.$rtti.$inherited("TColorTypeAlias", pas.unit1.$rtti["TColor"], {});', - 'rtl.createClass($mod, "TObject", null, function () {', + 'this.$rtti.$inherited("TColorTypeAlias", pas.unit1.$rtti["TColor"], {});', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.fColor = 0;', ' this.fAlias = 0;', @@ -29261,7 +29327,7 @@ begin ConvertProgram; CheckSource('TestRTTI_Class_OmitRTTI', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FA = 0;', ' };', @@ -29303,13 +29369,13 @@ begin ' "1": "blue",', ' blue: 1', '};', - '$mod.$rtti.$Enum("TEnum", {', + 'this.$rtti.$Enum("TEnum", {', ' minvalue: 0,', ' maxvalue: 1,', ' ordtype: 1,', ' enumtype: this.TEnum', '});', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FB = false;', ' };', @@ -29376,7 +29442,7 @@ begin CheckSource('TestRTTI_StoredModifier', LinesToStr([ // statements 'this.ConstB = true;', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FB = false;', ' };', @@ -29446,7 +29512,7 @@ begin ' "1": "blue",', ' blue: 1', '};', - '$mod.$rtti.$Enum("TEnum", {', + 'this.$rtti.$Enum("TEnum", {', ' minvalue: 0,', ' maxvalue: 1,', ' ordtype: 1,', @@ -29454,7 +29520,7 @@ begin '});', 'this.CB = true || false;', 'this.CI = 1 + 2;', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FB = false;', ' this.FI = 0;', @@ -29568,17 +29634,17 @@ begin ' "1": "blue",', ' blue: 1', '};', - '$mod.$rtti.$Enum("TEnum", {', + 'this.$rtti.$Enum("TEnum", {', ' minvalue: 0,', ' maxvalue: 1,', ' ordtype: 1,', ' enumtype: this.TEnum', '});', - '$mod.$rtti.$Set("TSet", {', - ' comptype: $mod.$rtti["TEnum"]', + 'this.$rtti.$Set("TSet", {', + ' comptype: this.$rtti["TEnum"]', '});', - 'this.CSet = rtl.createSet($mod.TEnum.red, $mod.TEnum.blue);', - 'rtl.createClass($mod, "TObject", null, function () {', + 'this.CSet = rtl.createSet(this.TEnum.red, this.TEnum.blue);', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FSet = {};', ' };', @@ -29652,14 +29718,14 @@ begin ConvertProgram; CheckSource('TestRTTI_DefaultValueRangeType', LinesToStr([ // statements - '$mod.$rtti.$Int("TRg", {', + 'this.$rtti.$Int("TRg", {', ' minvalue: -1,', ' maxvalue: 1,', ' ordtype: 0', '});', 'this.l = -1;', 'this.h = 1;', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FV = 0;', ' };', @@ -29702,7 +29768,7 @@ begin ConvertProgram; CheckSource('TestRTTI_DefaultValueInherit', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FA = 0;', ' this.FB = 0;', @@ -29710,7 +29776,7 @@ begin ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' var $r = this.$rtti;', ' $r.addProperty(', ' "A",', @@ -29747,7 +29813,7 @@ begin ConvertProgram; CheckSource('TestRTTI_OverrideMethod', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -29755,7 +29821,7 @@ begin ' var $r = this.$rtti;', ' $r.addMethod("DoIt", 0, null);', '});', - 'rtl.createClass($mod, "TSky", $mod.TObject, function () {', + 'rtl.createClass(this, "TSky", this.TObject, function () {', ' this.DoIt = function () {', ' };', '});', @@ -29787,7 +29853,7 @@ begin ConvertProgram; CheckSource('TestRTTI_ReintroduceMethod', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -29797,7 +29863,7 @@ begin ' var $r = this.$rtti;', ' $r.addMethod("DoIt", 0, null);', '});', - 'rtl.createClass($mod, "TSky", $mod.TObject, function () {', + 'rtl.createClass(this, "TSky", this.TObject, function () {', ' this.DoIt = function () {', ' $mod.TObject.DoIt.call(this);', ' };', @@ -29828,7 +29894,7 @@ begin ConvertProgram; CheckSource('TestRTTI_OverrideMethod', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FFlag = 0;', ' };', @@ -29837,7 +29903,7 @@ begin ' var $r = this.$rtti;', ' $r.addProperty("Flag", 0, rtl.longint, "FFlag", "");', '});', - 'rtl.createClass($mod, "TSky", $mod.TObject, function () {', + 'rtl.createClass(this, "TSky", this.TObject, function () {', ' var $r = this.$rtti;', ' $r.addProperty("Flag", 0, rtl.longint, "", "FFlag");', '});', @@ -29871,17 +29937,17 @@ begin ConvertProgram; CheckSource('TestRTTI_ClassForward', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - '$mod.$rtti.$Class("TBridge");', - '$mod.$rtti.$ProcVar("TProc", {', - ' procsig: rtl.newTIProcSig(null, $mod.$rtti["TBridge"])', + 'this.$rtti.$Class("TBridge");', + 'this.$rtti.$ProcVar("TProc", {', + ' procsig: rtl.newTIProcSig(null, this.$rtti["TBridge"])', '});', - 'rtl.createClass($mod, "TOger", $mod.TObject, function () {', + 'rtl.createClass(this, "TOger", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.FBridge = null;', @@ -29895,7 +29961,7 @@ begin ' $r.addMethod("SetBridge", 0, [["Value", $mod.$rtti["TBridge"]]]);', ' $r.addProperty("Bridge", 2, $mod.$rtti["TBridge"], "FBridge", "SetBridge");', '});', - 'rtl.createClass($mod, "TBridge", $mod.TObject, function () {', + 'rtl.createClass(this, "TBridge", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.FOger = null;', @@ -29937,14 +30003,14 @@ begin ConvertProgram; CheckSource('TestRTTI_ClassOf', LinesToStr([ // statements - '$mod.$rtti.$Class("TObject");', - '$mod.$rtti.$ClassRef("TClass", {', - ' instancetype: $mod.$rtti["TObject"]', + 'this.$rtti.$Class("TObject");', + 'this.$rtti.$ClassRef("TClass", {', + ' instancetype: this.$rtti["TObject"]', '});', - '$mod.$rtti.$ProcVar("TProcA", {', - ' procsig: rtl.newTIProcSig(null, $mod.$rtti["TClass"])', + 'this.$rtti.$ProcVar("TProcA", {', + ' procsig: rtl.newTIProcSig(null, this.$rtti["TClass"])', '});', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.C = null;', ' };', @@ -29954,22 +30020,22 @@ begin ' var $r = this.$rtti;', ' $r.addField("C", $mod.$rtti["TClass"]);', '});', - '$mod.$rtti.$Class("TFox");', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'this.$rtti.$Class("TFox");', + 'rtl.createClass(this, "TBird", this.TObject, function () {', '});', - '$mod.$rtti.$ClassRef("TBirds", {', - ' instancetype: $mod.$rtti["TBird"]', + 'this.$rtti.$ClassRef("TBirds", {', + ' instancetype: this.$rtti["TBird"]', '});', - 'rtl.createClass($mod, "TFox", $mod.TObject, function () {', + 'rtl.createClass(this, "TFox", this.TObject, function () {', '});', - '$mod.$rtti.$ClassRef("TFoxes", {', - ' instancetype: $mod.$rtti["TFox"]', + 'this.$rtti.$ClassRef("TFoxes", {', + ' instancetype: this.$rtti["TFox"]', '});', - '$mod.$rtti.$Class("TCow");', - '$mod.$rtti.$ClassRef("TCows", {', - ' instancetype: $mod.$rtti["TCow"]', + 'this.$rtti.$Class("TCow");', + 'this.$rtti.$ClassRef("TCows", {', + ' instancetype: this.$rtti["TCow"]', '});', - 'rtl.createClass($mod, "TCow", $mod.TObject, function () {', + 'rtl.createClass(this, "TCow", this.TObject, function () {', '});', '']), LinesToStr([ // $mod.$main @@ -29994,7 +30060,7 @@ begin ConvertProgram; CheckSource('TestRTTI_Record', LinesToStr([ // statements - 'rtl.recNewT($mod, "TPoint", function () {', + 'rtl.recNewT(this, "TPoint", function () {', ' this.x = 0;', ' this.y = 0;', ' this.$eq = function (b) {', @@ -30010,7 +30076,7 @@ begin ' $r.addField("y", rtl.longint);', '});', 'this.p = null;', - 'this.r = $mod.TPoint.$new();', + 'this.r = this.TPoint.$new();', '']), LinesToStr([ // $mod.$main '$mod.p = $mod.$rtti["TPoint"];', @@ -30037,7 +30103,7 @@ begin ConvertProgram; CheckSource('TestRTTI_Record', LinesToStr([ // statements - 'rtl.recNewT($mod, "TFloatRec", function () {', + 'rtl.recNewT(this, "TFloatRec", function () {', ' this.$new = function () {', ' var r = Object.create(this);', ' r.c = [];', @@ -30060,7 +30126,7 @@ begin ' $r.addField("d", $mod.$rtti["TFloatRec.d$a"]);', '});', 'this.p = null;', - 'this.r = $mod.TFloatRec.$new();', + 'this.r = this.TFloatRec.$new();', '']), LinesToStr([ // $mod.$main '$mod.p = $mod.$rtti["TFloatRec"];', @@ -30221,19 +30287,19 @@ begin ConvertProgram; CheckSource('TestRTTI_TypeInfo_Type_BaseTypes', LinesToStr([ // statements - '$mod.$rtti.$inherited("TCaption", rtl.string, {});', - '$mod.$rtti.$inherited("TYesNo", rtl.boolean, {});', - '$mod.$rtti.$inherited("TLetter", rtl.char, {});', - '$mod.$rtti.$inherited("TFloat", rtl.double, {});', - '$mod.$rtti.$inherited("TPtr", rtl.pointer, {});', - '$mod.$rtti.$inherited("TShortInt", rtl.shortint, {});', - '$mod.$rtti.$inherited("TByte", rtl.byte, {});', - '$mod.$rtti.$inherited("TSmallInt", rtl.smallint, {});', - '$mod.$rtti.$inherited("TWord", rtl.word, {});', - '$mod.$rtti.$inherited("TInt32", rtl.longint, {});', - '$mod.$rtti.$inherited("TDWord", rtl.longword, {});', - '$mod.$rtti.$inherited("TValue", rtl.jsvalue, {});', - '$mod.$rtti.$inherited("TAliasValue", $mod.$rtti["TValue"], {});', + 'this.$rtti.$inherited("TCaption", rtl.string, {});', + 'this.$rtti.$inherited("TYesNo", rtl.boolean, {});', + 'this.$rtti.$inherited("TLetter", rtl.char, {});', + 'this.$rtti.$inherited("TFloat", rtl.double, {});', + 'this.$rtti.$inherited("TPtr", rtl.pointer, {});', + 'this.$rtti.$inherited("TShortInt", rtl.shortint, {});', + 'this.$rtti.$inherited("TByte", rtl.byte, {});', + 'this.$rtti.$inherited("TSmallInt", rtl.smallint, {});', + 'this.$rtti.$inherited("TWord", rtl.word, {});', + 'this.$rtti.$inherited("TInt32", rtl.longint, {});', + 'this.$rtti.$inherited("TDWord", rtl.longword, {});', + 'this.$rtti.$inherited("TValue", rtl.jsvalue, {});', + 'this.$rtti.$inherited("TAliasValue", this.$rtti["TValue"], {});', 'this.p = null;', 'this.a = undefined;', '']), @@ -30310,14 +30376,14 @@ begin ' "1": "down",', ' down: 1', '};', - '$mod.$rtti.$Enum("TFlag", {', + 'this.$rtti.$Enum("TFlag", {', ' minvalue: 0,', ' maxvalue: 1,', ' ordtype: 1,', ' enumtype: this.TFlag', '});', - '$mod.$rtti.$Set("TFlags", {', - ' comptype: $mod.$rtti["TFlag"]', + 'this.$rtti.$Set("TFlags", {', + ' comptype: this.$rtti["TFlag"]', '});', 'this.ti = null;', 'this.tiInt = null;', @@ -30372,17 +30438,17 @@ begin ConvertProgram; CheckSource('TestRTTI_TypeInfo_ExtTypeInfoClasses2', LinesToStr([ // statements - '$mod.$rtti.$StaticArray("TStaticArr", {', + 'this.$rtti.$StaticArray("TStaticArr", {', ' dims: [2],', ' eltype: rtl.string', '});', - '$mod.$rtti.$DynArray("TDynArr", {', + 'this.$rtti.$DynArray("TDynArr", {', ' eltype: rtl.string', '});', - '$mod.$rtti.$ProcVar("TProc", {', + 'this.$rtti.$ProcVar("TProc", {', ' procsig: rtl.newTIProcSig(null)', '});', - '$mod.$rtti.$MethodVar("TMethod", {', + 'this.$rtti.$MethodVar("TMethod", {', ' procsig: rtl.newTIProcSig(null),', ' methodkind: 0', '});', @@ -30436,7 +30502,7 @@ begin ConvertProgram; CheckSource('TestRTTI_TypeInfo_ExtTypeInfoClasses3', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.$eq = function (b) {', ' return true;', ' };', @@ -30445,16 +30511,16 @@ begin ' };', ' $mod.$rtti.$Record("TRec", {});', '});', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - '$mod.$rtti.$ClassRef("TClass", {', - ' instancetype: $mod.$rtti["TObject"]', + 'this.$rtti.$ClassRef("TClass", {', + ' instancetype: this.$rtti["TObject"]', '});', - 'this.Rec = $mod.TRec.$new();', + 'this.Rec = this.TRec.$new();', 'this.tiRecord = null;', 'this.Obj = null;', 'this.tiClass = null;', @@ -30508,11 +30574,11 @@ begin ConvertProgram; CheckSource('TestRTTI_TypeInfo_FunctionClassType', LinesToStr([ // statements - '$mod.$rtti.$Class("TObject");', - '$mod.$rtti.$ClassRef("TClass", {', - ' instancetype: $mod.$rtti["TObject"]', + 'this.$rtti.$Class("TObject");', + 'this.$rtti.$ClassRef("TClass", {', + ' instancetype: this.$rtti["TObject"]', '});', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -30652,7 +30718,7 @@ begin CheckSource('TestRTTI_Interface_Corba', LinesToStr([ // statements 'rtl.createInterface(', - ' $mod,', + ' this,', ' "IUnknown",', ' "{B92D5841-758A-322B-B800-000000000000}",', ' [],', @@ -30661,7 +30727,7 @@ begin ' }', ');', 'rtl.createInterface(', - ' $mod,', + ' this,', ' "IBird",', ' "{D32D5841-6264-3AE3-A2C9-B91CE922C9B9}",', ' ["GetItem", "SetItem"],', @@ -30716,7 +30782,7 @@ begin ConvertProgram; CheckSource('TestRTTI_Interface_COM', LinesToStr([ // statements - 'rtl.recNewT($mod, "TGuid", function () {', + 'rtl.recNewT(this, "TGuid", function () {', ' this.$eq = function (b) {', ' return true;', ' };', @@ -30726,7 +30792,7 @@ begin ' $mod.$rtti.$Record("TGuid", {});', '});', 'rtl.createInterface(', - ' $mod,', + ' this,', ' "IUnknown",', ' "{D7ADB00D-1A9B-3EDC-B123-730E661DDFA9}",', ' ["QueryInterface", "_AddRef", "_Release"],', @@ -30740,11 +30806,11 @@ begin ' }', ');', 'rtl.createInterface(', - ' $mod,', + ' this,', ' "IBird",', ' "{9CC77572-0E45-3594-9A88-9E8D865C9E0A}",', ' ["GetItem", "SetItem"],', - ' $mod.IUnknown,', + ' this.IUnknown,', ' function () {', ' var $r = this.$rtti;', ' $r.addMethod("GetItem", 1, null, rtl.longint);', @@ -30787,13 +30853,13 @@ begin ConvertProgram; CheckSource('TestRTTI_ClassHelper', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.GetItem = function () {', ' var Result = 0;', ' return Result;', @@ -30828,11 +30894,11 @@ begin ConvertProgram; CheckSource('TestRTTI_ExternalClass', LinesToStr([ // statements - '$mod.$rtti.$ExtClass("TJSObject", {', + 'this.$rtti.$ExtClass("TJSObject", {', ' jsclass: "Object"', '});', - '$mod.$rtti.$ExtClass("TJSArray", {', - ' ancestor: $mod.$rtti["TJSObject"],', + 'this.$rtti.$ExtClass("TJSArray", {', + ' ancestor: this.$rtti["TJSObject"],', ' jsclass: "Array"', '});', 'this.p = null;', @@ -31000,7 +31066,7 @@ begin ConvertProgram; CheckSource('TestAttributes_Members', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -31009,12 +31075,12 @@ begin ' return this;', ' };', '});', - 'rtl.createClass($mod, "TCustomAttribute", $mod.TObject, function () {', + 'rtl.createClass(this, "TCustomAttribute", this.TObject, function () {', ' this.Create$1 = function (Id) {', ' return this;', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.$init = function () {', ' $mod.TObject.$init.call(this);', ' this.FField = 0;', @@ -31037,7 +31103,7 @@ begin ' attr: [$mod.TCustomAttribute, "Create$1", [15]]', ' });', '});', - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.Size = 0;', ' this.$eq = function (b) {', ' return this.Size === b.Size;', @@ -31094,7 +31160,7 @@ begin ConvertProgram; CheckSource('TestAttributes_Types', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -31103,13 +31169,13 @@ begin ' return this;', ' };', '});', - 'rtl.createClass($mod, "TCustomAttribute", $mod.TObject, function () {', + 'rtl.createClass(this, "TCustomAttribute", this.TObject, function () {', '});', - 'rtl.createClass($mod, "TMyClass", $mod.TObject, function () {', + 'rtl.createClass(this, "TMyClass", this.TObject, function () {', ' var $r = this.$rtti;', ' $r.attr = [$mod.TCustomAttribute, "Create", [1]];', '});', - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.$eq = function (b) {', ' return true;', ' };', @@ -31120,8 +31186,8 @@ begin ' attr: [$mod.TCustomAttribute, "Create", [2]]', ' });', '});', - '$mod.$rtti.$inherited("TInt", rtl.word, {', - ' attr: [$mod.TCustomAttribute, "Create", [3]]', + 'this.$rtti.$inherited("TInt", rtl.word, {', + ' attr: [this.TCustomAttribute, "Create", [3]]', '});', 'this.p = null;', '']), @@ -31264,7 +31330,7 @@ begin ConvertProgram; CheckSource('TestCheckMethodCall', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -31274,7 +31340,7 @@ begin ' $mod.b = rtl.asExt($mod.o, $mod.TBird, 1);', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', '});', 'this.o = null;', 'this.c = null;', @@ -31463,7 +31529,7 @@ begin ' "1": "green",', ' green: 1', '};', - 'this.e = $mod.TEnum.red;', + 'this.e = this.TEnum.red;', 'this.DoIt = function (p) {', ' rtl.rc(p, 0, 1);', ' $mod.e = rtl.rc(p, 0, 1);', @@ -31515,7 +31581,7 @@ begin ' "1": "green",', ' green: 1', '};', - 'this.e = $mod.TEnum.red;', + 'this.e = this.TEnum.red;', 'this.DoIt = function (p) {', ' rtl.rc(p, 0, 1);', ' $mod.e = rtl.rc(p, 0, 1);', @@ -31664,7 +31730,7 @@ begin ConvertProgram; CheckSource('TestRangeChecks_ArrayIndex', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.A = [];', ' };', @@ -31727,7 +31793,7 @@ begin ConvertProgram; CheckSource('TestRangeChecks_ArrayOfRecIndex', LinesToStr([ // statements - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.x = 0;', ' this.$eq = function (b) {', ' return this.x === b.x;', @@ -31737,7 +31803,7 @@ begin ' return this;', ' };', '});', - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.A = [];', ' };', @@ -31786,7 +31852,7 @@ begin ConvertProgram; CheckSource('TestRangeChecks_StringIndex', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.S = "";', ' };', @@ -31885,14 +31951,14 @@ begin ConvertProgram; CheckSource('TestRangeChecks_AssignInt', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FSize = 0;', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createHelper($mod, "THelper", null, function () {', + 'rtl.createHelper(this, "THelper", null, function () {', ' this.SetIt = function (w) {', ' rtl.rc(w, 0, 65535);', ' this.set(w);', @@ -32034,13 +32100,13 @@ begin ConvertProgram; CheckSource('TestAsync_CallResultIsPromise', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.Fly = async function () {', ' var Result = 0;', ' Result = 3;', @@ -32403,7 +32469,7 @@ begin ConvertProgram; CheckSource('TestAsync_Inherited', LinesToStr([ // statements - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -32413,7 +32479,7 @@ begin ' return Result;', ' };', '});', - 'rtl.createClass($mod, "TBird", $mod.TObject, function () {', + 'rtl.createClass(this, "TBird", this.TObject, function () {', ' this.Run = async function (w) {', ' var Result = 0;', ' var p = null;', diff --git a/packages/pastojs/tests/tcoptimizations.pas b/packages/pastojs/tests/tcoptimizations.pas index bc01348cd2..5523f2dbcc 100644 --- a/packages/pastojs/tests/tcoptimizations.pas +++ b/packages/pastojs/tests/tcoptimizations.pas @@ -17,7 +17,7 @@ ./testpas2js --suite=TTestOptimizations ./testpas2js --suite=TTestOptimizations.TestOmitLocalVar } -unit tcoptimizations; +unit TCOptimizations; {$mode objfpc}{$H+} @@ -26,7 +26,7 @@ interface uses Classes, SysUtils, testregistry, fppas2js, pastree, PScanner, Pas2jsUseAnalyzer, PasResolver, PasResolveEval, - tcmodules; + TCModules; type @@ -56,17 +56,10 @@ type TTestOptimizations = class(TCustomTestOptimizations) published - // unit optimization: jsaliasglobals - procedure TestOptAliasGlobals_Program; - procedure TestOptAliasGlobals_Unit_FromIntfImpl_ToIntfImpl; - // ToDo: external var, const, class - // ToDo: RTTI - // ToDo: typeinfo(var), typeinfo(type) - // ToDo: resourcestring - // ToDo: Global EnumType, EnumValue, EnumType.Value, unit.EnumType.Value - // ToDo: Nested EnumType: EnumValue, EnumType.Value, unit.aType.EnumType.Value, aType.EnumType.Value, Instance.EnumType.Value - // ToDo: Instance.RecordType, Instance.RecordType.ClassVar - // ToDo: ClassVarRecord + // unit optimization: jsshortrefglobals + procedure TestOptShortRefGlobals_Program; + procedure TestOptShortRefGlobals_Unit_FromIntfImpl_ToIntfImpl; + procedure TestOptShortRefGlobals_Property; // Whole Program Optimization procedure TestWPO_OmitLocalVar; @@ -199,7 +192,7 @@ end; { TTestOptimizations } -procedure TTestOptimizations.TestOptAliasGlobals_Program; +procedure TTestOptimizations.TestOptShortRefGlobals_Program; begin AddModuleWithIntfImplSrc('UnitA.pas', LinesToStr([ @@ -224,7 +217,7 @@ begin StartProgram(true,[supTObject]); Add([ - '{$optimization JSAliasGlobals}', + '{$optimization JSShortRefGlobals}', 'uses unita;', 'type', ' TEagle = class(TBird)', @@ -249,12 +242,12 @@ begin ' c:=cRedBlue;', '']); ConvertProgram; - CheckSource('TestOptAliasGlobals_Program', + CheckSource('TestOptShortRefGlobals_Program', LinesToStr([ 'var $lm = pas.UnitA;', 'var $lt = $lm.TBird;', 'var $lt1 = $lm.TRec;', - 'rtl.createClass($mod, "TEagle", $lt, function () {', + 'rtl.createClass(this, "TEagle", $lt, function () {', ' this.Run = function (w) {', ' var Result = 0;', ' return Result;', @@ -277,7 +270,7 @@ begin ''])); end; -procedure TTestOptimizations.TestOptAliasGlobals_Unit_FromIntfImpl_ToIntfImpl; +procedure TTestOptimizations.TestOptShortRefGlobals_Unit_FromIntfImpl_ToIntfImpl; begin AddModuleWithIntfImplSrc('UnitA.pas', LinesToStr([ @@ -311,7 +304,7 @@ begin ''])); StartUnit(true,[supTObject]); Add([ - '{$optimization JSAliasGlobals}', + '{$optimization JSShortRefGlobals}', 'interface', 'uses unita;', 'type', @@ -354,7 +347,7 @@ begin ' RedAnt.Run;', '']); ConvertUnit; - CheckSource('TestOptAliasGlobals_Unit_FromIntfImpl_ToIntfImpl', + CheckSource('TestOptShortRefGlobals_Unit_FromIntfImpl_ToIntfImpl', LinesToStr([ 'var $impl = $mod.$impl;', 'var $lm = pas.UnitA;', @@ -363,7 +356,7 @@ begin 'var $lt1 = null;', 'var $lt2 = null;', 'var $lt3 = null;', - 'rtl.createClass($mod, "TEagle", $lt, function () {', + 'rtl.createClass(this, "TEagle", $lt, function () {', ' this.Fly = function () {', ' $impl.TRedAnt.$create("Create");', ' $lt1.$create("Create");', @@ -402,6 +395,55 @@ begin ''])); end; +procedure TTestOptimizations.TestOptShortRefGlobals_Property; +begin + AddModuleWithIntfImplSrc('UnitA.pas', + LinesToStr([ + 'type', + ' TBird = class', + ' FWing: TObject;', + ' class var FLeg: TObject;', + ' public', + ' property Wing: TObject read FWing write FWing;', + ' class property Leg: TObject read FLeg write FLeg;', + ' end;', + '']), + LinesToStr([ + ''])); + StartUnit(true,[supTObject]); + Add([ + '{$optimization JSShortRefGlobals}', + 'interface', + 'uses unita;', + 'type', + ' TEagle = class(TBird)', // intf-JS to intf-uses + ' procedure Fly(o: TObject);', + ' end;', + 'implementation', + 'procedure TEagle.Fly(o: TObject);', + 'begin', + ' Fly(Wing);', + ' Fly(Leg);', + 'end;', + '']); + ConvertUnit; + CheckSource('TestOptShortRefGlobals_Property', + LinesToStr([ + 'var $lm = pas.UnitA;', + 'var $lt = $lm.TBird;', + 'rtl.createClass(this, "TEagle", $lt, function () {', + ' this.Fly = function (o) {', + ' this.Fly(this.FWing);', + ' this.Fly(this.FLeg);', + ' };', + '});', + '']), + LinesToStr([ + '']), + LinesToStr([ + ''])); +end; + procedure TTestOptimizations.TestWPO_OmitLocalVar; begin StartProgram(false); @@ -605,7 +647,7 @@ begin ConvertProgram; CheckSource('TestWPO_OmitRecordMember', LinesToStr([ - 'rtl.recNewT($mod, "TRec", function () {', + 'rtl.recNewT(this, "TRec", function () {', ' this.a = 0;', ' this.$eq = function (b) {', ' return this.a === b.a;', @@ -615,7 +657,7 @@ begin ' return this;', ' };', '});', - 'this.r = $mod.TRec.$new();', + 'this.r = this.TRec.$new();', '']), LinesToStr([ '$mod.r.a = 3;', @@ -653,7 +695,7 @@ begin ConvertProgram; CheckSource('TestWPO_TObject', LinesToStr([ - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -693,7 +735,7 @@ begin ConvertProgram; CheckSource('TestWPO_Class_TObject', LinesToStr([ - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -725,7 +767,7 @@ begin ConvertProgram; CheckSource('TestWPO_OmitClassField', LinesToStr([ - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.a = 0;', ' };', @@ -754,7 +796,7 @@ begin ConvertProgram; CheckSource('TestWPO_OmitClassMethod', LinesToStr([ - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -784,7 +826,7 @@ begin ConvertProgram; CheckSource('TestWPO_OmitClassMethod', LinesToStr([ - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -820,7 +862,7 @@ begin ConvertProgram; CheckSource('TestWPO_OmitClassPropertyGetter1', LinesToStr([ - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FFoo = false;', ' };', @@ -851,7 +893,7 @@ begin ConvertProgram; CheckSource('TestWPO_OmitClassPropertyGetter2', LinesToStr([ - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FFoo = false;', ' };', @@ -892,7 +934,7 @@ begin ConvertProgram; CheckSource('TestWPO_OmitClassPropertySetter1', LinesToStr([ - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FFoo = false;', ' };', @@ -923,7 +965,7 @@ begin ConvertProgram; CheckSource('TestWPO_OmitClassPropertySetter2', LinesToStr([ - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FFoo = false;', ' };', @@ -970,7 +1012,7 @@ begin ConvertProgram; CheckSource('TestWPO_Class_KeepNewInstance', LinesToStr([ - 'rtl.createClassExt($mod, "TBird", Object, "NewInstance", function () {', + 'rtl.createClassExt(this, "TBird", Object, "NewInstance", function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -1019,7 +1061,7 @@ begin ConvertProgram; CheckSource('TestWPO_CallInherited', LinesToStr([ - 'rtl.createClass($mod, "TObject", null, function () {', + 'rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' };', ' this.$final = function () {', @@ -1029,7 +1071,7 @@ begin ' this.DoB = function () {', ' };', '});', - ' rtl.createClass($mod, "TMobile", $mod.TObject, function () {', + ' rtl.createClass(this, "TMobile", this.TObject, function () {', ' this.DoA$1 = function () {', ' $mod.TObject.DoA.call(this);', ' };', @@ -1096,7 +1138,7 @@ begin LinesToStr([ 'rtl.module("system", [], function () {', ' var $mod = this;', - ' rtl.recNewT($mod, "TVarRec", function () {', + ' rtl.recNewT(this, "TVarRec", function () {', ' this.VType = 0;', ' this.VJSValue = undefined;', ' this.$eq = function (b) {', @@ -1175,7 +1217,7 @@ begin LinesToStr([ 'rtl.module("unit1", ["system"], function () {', ' var $mod = this;', - ' rtl.createClass($mod, "TObject", null, function () {', + ' rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.FA = 0;', ' };', @@ -1250,7 +1292,7 @@ begin 'rtl.module("program",["system"],function () {', ' var $mod = this;', ' this.gcBlack = 0;', - ' rtl.createClass($mod,"TObject",null,function () {', + ' rtl.createClass(this,"TObject",null,function () {', ' this.$init = function () {', ' this.FColor = 0;', ' };', @@ -1294,10 +1336,10 @@ begin ExpectedSrc:=LinesToStr([ 'rtl.module("program", ["system"], function () {', ' var $mod = this;', - ' $mod.$rtti.$DynArray("TArrB", {', + ' this.$rtti.$DynArray("TArrB", {', ' eltype: rtl.string', ' });', - ' rtl.createClass($mod, "TObject", null, function () {', + ' rtl.createClass(this, "TObject", null, function () {', ' this.$init = function () {', ' this.PublicA = [];', ' this.PublishedB = [];', @@ -1339,7 +1381,7 @@ begin ExpectedSrc:=LinesToStr([ 'rtl.module("program", ["system"], function () {', ' var $mod = this;', - ' $mod.$rtti.$DynArray("TArrB", {', + ' this.$rtti.$DynArray("TArrB", {', ' eltype: rtl.string', ' });', ' this.A = [];', diff --git a/packages/pastojs/tests/testpas2js.lpi b/packages/pastojs/tests/testpas2js.lpi index 05dc286e13..97d1d48f1b 100644 --- a/packages/pastojs/tests/testpas2js.lpi +++ b/packages/pastojs/tests/testpas2js.lpi @@ -59,6 +59,7 @@ <Unit4> <Filename Value="tcoptimizations.pas"/> <IsPartOfProject Value="True"/> + <UnitName Value="TCOptimizations"/> </Unit4> <Unit5> <Filename Value="tcsrcmap.pas"/> |