mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-03 09:29:42 +01:00
pastojs: fixed tests
git-svn-id: trunk@40708 -
This commit is contained in:
parent
b1752fb4ce
commit
8604d83436
@ -406,7 +406,6 @@ ToDos:
|
||||
-C3 : Turn on ieee error checking for constants
|
||||
- optimizations:
|
||||
- move rtl.js functions to system.pp
|
||||
- less brackets on logical and/or/xor, add
|
||||
- add $mod only if needed
|
||||
- add Self only if needed
|
||||
- use a number for small sets
|
||||
@ -414,20 +413,22 @@ ToDos:
|
||||
- shortcut for test set is empty a=[] a<>[]
|
||||
- set operators on literals without temporary arrays, a in [b], [a]*b<>[]
|
||||
- combine multiple var a=0,b=0
|
||||
- init a local var with the first assignment
|
||||
- skip clone array for new array and arraysetlength
|
||||
- SetLength(scope.a,l) -> read scope only once, same for
|
||||
Include, Exclude, Inc, Dec, +=, -=, *=, /=
|
||||
- inline -Si
|
||||
- autoinline
|
||||
-O1 insert local/unit vars for global type references:
|
||||
at start of intf var $r1=null;
|
||||
at end of impl: $r1=path;
|
||||
-O1 insert unit vars for complex literals
|
||||
-O1 no function Result var when assigned only once
|
||||
-O1 replace constant expression with result
|
||||
-O1 pass array element by ref: when index is constant, use that directly
|
||||
-O1 case-of with 6+ elements as binary tree
|
||||
-O2 insert local/unit vars for global type references:
|
||||
at start of intf var $r1=null;
|
||||
at end of impl: $r1=path;
|
||||
-O2 removeemptyprocs
|
||||
-O2 skip dead code If(false){...}
|
||||
-O2 CSE
|
||||
-O3 DFA
|
||||
- objects
|
||||
|
||||
@ -2703,7 +2703,7 @@ begin
|
||||
'$mod.vB = $mod.vA + $mod.vA;',
|
||||
'$mod.vB = Math.floor($mod.vA / $mod.vB);',
|
||||
'$mod.vB = $mod.vA % $mod.vB;',
|
||||
'$mod.vB = ($mod.vA + ($mod.vA * $mod.vB)) + Math.floor($mod.vA / $mod.vB);',
|
||||
'$mod.vB = $mod.vA + ($mod.vA * $mod.vB) + Math.floor($mod.vA / $mod.vB);',
|
||||
'$mod.vC = -$mod.vA;',
|
||||
'$mod.vA = $mod.vA - $mod.vB;',
|
||||
'$mod.vB = $mod.vA;',
|
||||
@ -2916,13 +2916,13 @@ begin
|
||||
' function Nesty(pA) {',
|
||||
' var Result$1 = 0;',
|
||||
' var vB = 0;',
|
||||
' Result$1 = (((pA + vB) + vC) + pD) + $mod.vInUnit;',
|
||||
' Result$1 = pA + vB + vC + pD + $mod.vInUnit;',
|
||||
' Result$1 = 3;',
|
||||
' Result = 4;',
|
||||
' return Result$1;',
|
||||
' return Result$1;',
|
||||
' };',
|
||||
' Result = (pA + vB) + vC;',
|
||||
' Result = pA + vB + vC;',
|
||||
' Result = 6;',
|
||||
' return Result;',
|
||||
' return Result;',
|
||||
@ -3852,7 +3852,7 @@ begin
|
||||
'this.B = 3 + 1;',
|
||||
'var C = 3 + 1;',
|
||||
'var D = 4 + 1;',
|
||||
'var E = ((5 + 4) + 4) + 3;',
|
||||
'var E = 5 + 4 + 4 + 3;',
|
||||
'this.DoIt = function () {',
|
||||
'};',
|
||||
'']),
|
||||
@ -5647,9 +5647,9 @@ begin
|
||||
'this.DoIt = function () {',
|
||||
' function Sub() {',
|
||||
' cB$1 = cB$1 + 3;',
|
||||
' cA = (cA + 3) + 5;',
|
||||
' cA = cA + 3 + 5;',
|
||||
' };',
|
||||
' cA = (cA + 2) + 6;',
|
||||
' cA = cA + 2 + 6;',
|
||||
'};'
|
||||
]),
|
||||
LinesToStr([
|
||||
@ -6605,11 +6605,11 @@ begin
|
||||
'$mod.s = ""+$mod.b;',
|
||||
'$mod.s = ""+$mod.i;',
|
||||
'$mod.s = rtl.floatToStr($mod.d);',
|
||||
'$mod.s = (""+$mod.i)+$mod.i;',
|
||||
'$mod.s = ""+$mod.i+$mod.i;',
|
||||
'$mod.s = rtl.spaceLeft(""+$mod.i,3);',
|
||||
'$mod.s = rtl.floatToStr($mod.d,3,2);',
|
||||
'$mod.s = rtl.spaceLeft("" + $mod.i, 4) + $mod.i;',
|
||||
'$mod.s = ("" + $mod.i) + rtl.spaceLeft("" + $mod.i, 5);',
|
||||
'$mod.s = "" + $mod.i + rtl.spaceLeft("" + $mod.i, 5);',
|
||||
'$mod.s = rtl.spaceLeft("" + $mod.i, 4) + rtl.spaceLeft("" + $mod.i, 5);',
|
||||
'$mod.s = $mod.s + $mod.s;',
|
||||
'$mod.s = $mod.s + "foo";',
|
||||
@ -7490,7 +7490,7 @@ begin
|
||||
'var $tmp1 = $mod.s;',
|
||||
'if ($tmp1 === "foo") {',
|
||||
' $mod.s = $mod.h}',
|
||||
' else if (($tmp1.length === 1) && (($tmp1 >= "a") && ($tmp1 <= "z"))) $mod.h = $mod.s;',
|
||||
' else if (($tmp1.length === 1) && ($tmp1 >= "a") && ($tmp1 <= "z")) $mod.h = $mod.s;',
|
||||
'']));
|
||||
end;
|
||||
|
||||
@ -7953,7 +7953,7 @@ begin
|
||||
'this.Arr = rtl.arraySetLength(null, $mod.TRec, 2);',
|
||||
'']),
|
||||
LinesToStr([ // $mod.$main
|
||||
'$mod.Arr[0].Int = (2 + 1) + 2;']));
|
||||
'$mod.Arr[0].Int = 2 + 1 + 2;']));
|
||||
end;
|
||||
|
||||
procedure TTestModule.TestArrayOfSet;
|
||||
@ -8402,7 +8402,7 @@ begin
|
||||
' var s = "";',
|
||||
' for (var $l1 = 0, $end2 = rtl.length(a) - 1; $l1 <= $end2; $l1++) {',
|
||||
' i = $l1;',
|
||||
' s = a[(rtl.length(a) - i) - 1];',
|
||||
' s = a[rtl.length(a) - i - 1];',
|
||||
' };',
|
||||
'};',
|
||||
'this.s = "";',
|
||||
@ -8687,7 +8687,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($mod.Names) - 1) + rtl.length($mod.Names);',
|
||||
'this.i = 0;',
|
||||
'']),
|
||||
LinesToStr([ // $mod.$main
|
||||
@ -8733,7 +8733,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($mod.Names) - 1) + rtl.length($mod.Names);',
|
||||
'']),
|
||||
LinesToStr([ // $mod.$main
|
||||
'']));
|
||||
@ -9234,9 +9234,9 @@ begin
|
||||
' this.Enums = {};',
|
||||
' };',
|
||||
' this.$equal = function (b) {',
|
||||
' return (this.Int === b.Int) && ((this.D === b.D) && ((this.Arr === b.Arr)',
|
||||
' && (rtl.arrayEq(this.Arr2, b.Arr2)',
|
||||
' && (this.Small.$equal(b.Small) && rtl.eqSet(this.Enums, b.Enums)))));',
|
||||
' return (this.Int === b.Int) && (this.D === b.D) && (this.Arr === b.Arr)',
|
||||
' && rtl.arrayEq(this.Arr2, b.Arr2)',
|
||||
' && this.Small.$equal(b.Small) && rtl.eqSet(this.Enums, b.Enums);',
|
||||
' };',
|
||||
'};',
|
||||
'this.r = new $mod.TBigRec();',
|
||||
@ -9557,7 +9557,7 @@ begin
|
||||
' this.f = {};',
|
||||
' };',
|
||||
' this.$equal = function (b) {',
|
||||
' return (this.i === b.i) && (rtl.eqCallback(this.Event, b.Event) && rtl.eqSet(this.f, b.f));',
|
||||
' return (this.i === b.i) && rtl.eqCallback(this.Event, b.Event) && rtl.eqSet(this.f, b.f);',
|
||||
' };',
|
||||
'};',
|
||||
'this.TNested = function (s) {',
|
||||
@ -9659,7 +9659,7 @@ begin
|
||||
' this.o = rtl.arraySetLength(null, 0, 2);',
|
||||
' };',
|
||||
' this.$equal = function (b) {',
|
||||
' return (this.a === b.a) && (rtl.arrayEq(this.s, b.s) && (rtl.arrayEq(this.m, b.m) && rtl.arrayEq(this.o, b.o)));',
|
||||
' return (this.a === b.a) && rtl.arrayEq(this.s, b.s) && rtl.arrayEq(this.m, b.m) && rtl.arrayEq(this.o, b.o);',
|
||||
' };',
|
||||
'};',
|
||||
'']),
|
||||
@ -9722,7 +9722,7 @@ begin
|
||||
' this.p = new $mod.TPoint();',
|
||||
' };',
|
||||
' this.$equal = function (b) {',
|
||||
' return (this.i === b.i) && ((this.a === b.a) && (rtl.arrayEq(this.s, b.s) && (rtl.arrayEq(this.m, b.m) && this.p.$equal(b.p))));',
|
||||
' return (this.i === b.i) && (this.a === b.a) && rtl.arrayEq(this.s, b.s) && rtl.arrayEq(this.m, b.m) && this.p.$equal(b.p);',
|
||||
' };',
|
||||
'};',
|
||||
'this.r = new $mod.TRec({',
|
||||
@ -17295,7 +17295,7 @@ begin
|
||||
' this.D4 = 0;',
|
||||
' };',
|
||||
' this.$equal = function (b) {',
|
||||
' return (this.D1 === b.D1) && ((this.D2 === b.D2) && ((this.D3 === b.D3) && (this.D4 === b.D4)));',
|
||||
' return (this.D1 === b.D1) && (this.D2 === b.D2) && (this.D3 === b.D3) && (this.D4 === b.D4);',
|
||||
' };',
|
||||
'};',
|
||||
'this.DoConstGUIDIt = function (g) {',
|
||||
@ -17410,7 +17410,7 @@ begin
|
||||
' this.D4 = 0;',
|
||||
' };',
|
||||
' this.$equal = function (b) {',
|
||||
' return (this.D1 === b.D1) && ((this.D2 === b.D2) && ((this.D3 === b.D3) && (this.D4 === b.D4)));',
|
||||
' return (this.D1 === b.D1) && (this.D2 === b.D2) && (this.D3 === b.D3) && (this.D4 === b.D4);',
|
||||
' };',
|
||||
'};',
|
||||
'rtl.createClass($mod, "TObject", null, function () {',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user