Browse Source

pastojs: use strict equal when converting equal

git-svn-id: trunk@36721 -
Mattias Gaertner 8 năm trước cách đây
mục cha
commit
b884ab31fa

+ 28 - 15
packages/pastojs/src/fppas2js.pp

@@ -248,7 +248,6 @@ Works:
 - dotted unit names, namespaces
 - dotted unit names, namespaces
 
 
 ToDos:
 ToDos:
-- change some == into ===
 - constant evaluation
 - constant evaluation
 - static arrays
 - static arrays
 - property index specifier
 - property index specifier
@@ -258,9 +257,8 @@ ToDos:
     - defaultvalue
     - defaultvalue
   - type alias type
   - type alias type
   - documentation
   - documentation
-- sourcemaps
 - move local types to unit scope
 - move local types to unit scope
-- local var absolute
+- var absolute
 - FuncName:= (instead of Result:=)
 - FuncName:= (instead of Result:=)
 - check memleaks
 - check memleaks
 - @@ compare method in delphi mode
 - @@ compare method in delphi mode
@@ -3993,8 +3991,8 @@ Const
    Nil, // And
    Nil, // And
    Nil, // Or
    Nil, // Or
    Nil, // XOr
    Nil, // XOr
-   TJSEqualityExpressionEQ,
-   TJSEqualityExpressionNE,
+   TJSEqualityExpressionSEQ,
+   TJSEqualityExpressionSNE,
    TJSRelationalExpressionLT,
    TJSRelationalExpressionLT,
    TJSRelationalExpressionGT,
    TJSRelationalExpressionGT,
    TJSRelationalExpressionLE,
    TJSRelationalExpressionLE,
@@ -4320,6 +4318,19 @@ begin
         B:=nil;
         B:=nil;
         exit;
         exit;
         end;
         end;
+      end
+    else if AContext.Resolver.IsJSBaseType(LeftResolved,pbtJSValue)
+        or AContext.Resolver.IsJSBaseType(RightResolved,pbtJSValue) then
+      begin
+        // convert "jsvalue = something" to "jsvalue == something" (not strict)
+        // Note: default "=" is converted to "===" (strict equal)
+        if El.OpCode=eopEqual then
+          Result:=TJSEqualityExpressionEQ(CreateElement(TJSEqualityExpressionEQ,El))
+        else
+          Result:=TJSEqualityExpressionNE(CreateElement(TJSEqualityExpressionNE,El));
+        TJSBinaryExpression(Result).A:=A; A:=nil;
+        TJSBinaryExpression(Result).B:=B; B:=nil;
+        exit;
       end;
       end;
     end;
     end;
 end;
 end;
@@ -6375,7 +6386,7 @@ end;
 function TPasToJSConverter.ConvertBuiltIn_Assigned(El: TParamsExpr;
 function TPasToJSConverter.ConvertBuiltIn_Assigned(El: TParamsExpr;
   AContext: TConvertContext): TJSElement;
   AContext: TConvertContext): TJSElement;
 var
 var
-  NE: TJSEqualityExpressionNE;
+  NE: TJSEqualityExpressionSNE;
   Param: TPasExpr;
   Param: TPasExpr;
   ParamResolved: TPasResolverResult;
   ParamResolved: TPasResolverResult;
   C: TClass;
   C: TClass;
@@ -6392,10 +6403,10 @@ begin
   {$ENDIF}
   {$ENDIF}
   if ParamResolved.BaseType=btPointer then
   if ParamResolved.BaseType=btPointer then
     begin
     begin
-    // convert Assigned(value)  ->  value!=null
+    // convert Assigned(value)  ->  value!==null
     Result:=ConvertElement(Param,AContext);
     Result:=ConvertElement(Param,AContext);
     // Note: convert Param first, it may raise an exception
     // Note: convert Param first, it may raise an exception
-    NE:=TJSEqualityExpressionNE(CreateElement(TJSEqualityExpressionNE,El));
+    NE:=TJSEqualityExpressionSNE(CreateElement(TJSEqualityExpressionSNE,El));
     NE.A:=Result;
     NE.A:=Result;
     NE.B:=CreateLiteralNull(El);
     NE.B:=CreateLiteralNull(El);
     Result:=NE;
     Result:=NE;
@@ -6407,10 +6418,10 @@ begin
         or (C=TPasClassOfType)
         or (C=TPasClassOfType)
         or C.InheritsFrom(TPasProcedureType) then
         or C.InheritsFrom(TPasProcedureType) then
       begin
       begin
-      // convert Assigned(value)  ->  value!=null
+      // convert Assigned(value)  ->  value!==null
       Result:=ConvertElement(Param,AContext);
       Result:=ConvertElement(Param,AContext);
       // Note: convert Param first, it may raise an exception
       // Note: convert Param first, it may raise an exception
-      NE:=TJSEqualityExpressionNE(CreateElement(TJSEqualityExpressionNE,El));
+      NE:=TJSEqualityExpressionSNE(CreateElement(TJSEqualityExpressionSNE,El));
       NE.A:=Result;
       NE.A:=Result;
       NE.B:=CreateLiteralNull(El);
       NE.B:=CreateLiteralNull(El);
       Result:=NE;
       Result:=NE;
@@ -8687,7 +8698,7 @@ var
   JSAndExpr: TJSLogicalAndExpression;
   JSAndExpr: TJSLogicalAndExpression;
   JSLEExpr: TJSRelationalExpressionLE;
   JSLEExpr: TJSRelationalExpressionLE;
   JSGEExpr: TJSRelationalExpressionGE;
   JSGEExpr: TJSRelationalExpressionGE;
-  JSEQExpr: TJSEqualityExpressionEQ;
+  JSEQExpr: TJSEqualityExpressionSEQ;
 begin
 begin
   Result:=nil;
   Result:=nil;
   if UseSwitchStatement then
   if UseSwitchStatement then
@@ -8770,7 +8781,7 @@ begin
           else
           else
             begin
             begin
             // value -> create (tmp==Expr)
             // value -> create (tmp==Expr)
-            JSEQExpr:=TJSEqualityExpressionEQ(CreateElement(TJSEqualityExpressionEQ,Expr));
+            JSEQExpr:=TJSEqualityExpressionSEQ(CreateElement(TJSEqualityExpressionSEQ,Expr));
             JSExpr:=JSEQExpr;
             JSExpr:=JSEQExpr;
             JSEQExpr.A:=CreateIdentifierExpr(TmpVarName,El.CaseExpr,AContext);
             JSEQExpr.A:=CreateIdentifierExpr(TmpVarName,El.CaseExpr,AContext);
             JSEQExpr.B:=ConvertExpression(Expr,AContext);
             JSEQExpr.B:=ConvertExpression(Expr,AContext);
@@ -10819,6 +10830,8 @@ end;
 
 
 function TPasToJSConverter.CreateCmpArrayWithNil(El: TPasElement;
 function TPasToJSConverter.CreateCmpArrayWithNil(El: TPasElement;
   JSArray: TJSElement; OpCode: TExprOpCode): TJSElement;
   JSArray: TJSElement; OpCode: TExprOpCode): TJSElement;
+// convert "array = nil" to "rtl.length(array) > 0"
+// convert "array <> nil" to "rtl.length(array) === 0"
 var
 var
   Call: TJSCallExpression;
   Call: TJSCallExpression;
   BinExpr: TJSBinaryExpression;
   BinExpr: TJSBinaryExpression;
@@ -10829,7 +10842,7 @@ begin
   Call.Expr:=CreateMemberExpression([FBuiltInNames[pbivnRTL],FBuiltInNames[pbifnArray_Length]]);
   Call.Expr:=CreateMemberExpression([FBuiltInNames[pbivnRTL],FBuiltInNames[pbifnArray_Length]]);
   Call.AddArg(JSArray);
   Call.AddArg(JSArray);
   if OpCode=eopEqual then
   if OpCode=eopEqual then
-    BinExpr:=TJSEqualityExpressionEQ(CreateElement(TJSEqualityExpressionEQ,El))
+    BinExpr:=TJSEqualityExpressionSEQ(CreateElement(TJSEqualityExpressionSEQ,El))
   else
   else
     BinExpr:=TJSRelationalExpressionGT(CreateElement(TJSRelationalExpressionGT,El));
     BinExpr:=TJSRelationalExpressionGT(CreateElement(TJSRelationalExpressionGT,El));
   BinExpr.A:=Call;
   BinExpr.A:=Call;
@@ -11824,7 +11837,7 @@ const
     i: Integer;
     i: Integer;
     PasVar: TPasVariable;
     PasVar: TPasVariable;
     FDS: TJSFunctionDeclarationStatement;
     FDS: TJSFunctionDeclarationStatement;
-    EqExpr: TJSEqualityExpressionEQ;
+    EqExpr: TJSEqualityExpressionSEQ;
     LastAndExpr: TJSLogicalAndExpression;
     LastAndExpr: TJSLogicalAndExpression;
     VarType: TPasType;
     VarType: TPasType;
     Call: TJSCallExpression;
     Call: TJSCallExpression;
@@ -11885,7 +11898,7 @@ const
       else
       else
         begin
         begin
         // default: use simple equal "=="
         // default: use simple equal "=="
-        EqExpr:=TJSEqualityExpressionEQ(CreateElement(TJSEqualityExpressionEQ,PasVar));
+        EqExpr:=TJSEqualityExpressionSEQ(CreateElement(TJSEqualityExpressionSEQ,PasVar));
         Add_AndExpr_ToReturnSt(RetSt,PasVar,LastAndExpr,EqExpr);
         Add_AndExpr_ToReturnSt(RetSt,PasVar,LastAndExpr,EqExpr);
         EqExpr.A:=CreateMemberExpression(['this',VarName]);
         EqExpr.A:=CreateMemberExpression(['this',VarName]);
         EqExpr.B:=CreateMemberExpression([EqualParamName,VarName]);
         EqExpr.B:=CreateMemberExpression([EqualParamName,VarName]);

+ 4 - 4
packages/pastojs/tests/tcconverter.pp

@@ -1036,13 +1036,13 @@ end;
 Procedure TTestExpressionConverter.TestBinaryEqual;
 Procedure TTestExpressionConverter.TestBinaryEqual;
 Var
 Var
   B : TBinaryExpr;
   B : TBinaryExpr;
-  E : TJSEqualityExpressionEq;
+  E : TJSEqualityExpressionSEQ;
 
 
 begin
 begin
   B:=TBinaryExpr.Create(Nil,pekBinary,eopEqual);
   B:=TBinaryExpr.Create(Nil,pekBinary,eopEqual);
   B.left:=CreateLiteral(13);
   B.left:=CreateLiteral(13);
   B.Right:=CreateLiteral(3);
   B.Right:=CreateLiteral(3);
-  E:=TJSEqualityExpressionEq(TestBinaryExpression(B,TJSEqualityExpressionEq));
+  E:=TJSEqualityExpressionSEQ(TestBinaryExpression(B,TJSEqualityExpressionSEQ));
   AssertLiteral('Correct left literal for equal',E.A,13);
   AssertLiteral('Correct left literal for equal',E.A,13);
   AssertLiteral('Correct right literal for equal',E.B,3);
   AssertLiteral('Correct right literal for equal',E.B,3);
 end;
 end;
@@ -1050,13 +1050,13 @@ end;
 Procedure TTestExpressionConverter.TestBinaryNotEqual;
 Procedure TTestExpressionConverter.TestBinaryNotEqual;
 Var
 Var
   B : TBinaryExpr;
   B : TBinaryExpr;
-  E : TJSEqualityExpressionNE;
+  E : TJSEqualityExpressionSNE;
 
 
 begin
 begin
   B:=TBinaryExpr.Create(Nil,pekBinary,eopNotEqual);
   B:=TBinaryExpr.Create(Nil,pekBinary,eopNotEqual);
   B.left:=CreateLiteral(13);
   B.left:=CreateLiteral(13);
   B.Right:=CreateLiteral(3);
   B.Right:=CreateLiteral(3);
-  E:=TJSEqualityExpressionNE(TestBinaryExpression(B,TJSEqualityExpressionNE));
+  E:=TJSEqualityExpressionSNE(TestBinaryExpression(B,TJSEqualityExpressionSNE));
   AssertLiteral('Correct left literal for not equal',E.A,13);
   AssertLiteral('Correct left literal for not equal',E.A,13);
   AssertLiteral('Correct right literal for not equal',E.B,3);
   AssertLiteral('Correct right literal for not equal',E.B,3);
 end;
 end;

+ 151 - 151
packages/pastojs/tests/tcmodules.pas

@@ -2137,7 +2137,7 @@ begin
     '  $mod.FuncA(Bar);',
     '  $mod.FuncA(Bar);',
     '};',
     '};',
     'this.FuncA = function (Bar) {',
     'this.FuncA = function (Bar) {',
-    '  if (Bar == 3);',
+    '  if (Bar === 3);',
     '};'
     '};'
     ]),
     ]),
     LinesToStr([
     LinesToStr([
@@ -2173,7 +2173,7 @@ begin
     '    FuncB(i);',
     '    FuncB(i);',
     '  };',
     '  };',
     '  function FuncB(i) {',
     '  function FuncB(i) {',
-    '    if (i == 3);',
+    '    if (i === 3);',
     '  };',
     '  };',
     '  FuncC(4);',
     '  FuncC(4);',
     '};'
     '};'
@@ -2238,8 +2238,8 @@ begin
     ]),
     ]),
     LinesToStr([
     LinesToStr([
     'if ($mod.Func2());',
     'if ($mod.Func2());',
-    'if ($mod.i == $mod.Func1());',
-    'if ($mod.i == $mod.Func1());'
+    'if ($mod.i === $mod.Func1());',
+    'if ($mod.i === $mod.Func1());'
     ]));
     ]));
 end;
 end;
 
 
@@ -3620,7 +3620,7 @@ begin
     '    this.i = 0;',
     '    this.i = 0;',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return this.i == b.i;',
+    '    return this.i === b.i;',
     '  };',
     '  };',
     '};',
     '};',
     '$impl.aRec = new $impl.TMyRecord();',
     '$impl.aRec = new $impl.TMyRecord();',
@@ -3844,11 +3844,11 @@ begin
     'this.b = false;'
     'this.b = false;'
     ]),
     ]),
     LinesToStr([
     LinesToStr([
-    '$mod.b = $mod.c == "1";',
-    '$mod.b = "2" == $mod.c;',
-    '$mod.b = "3" == "4";',
-    '$mod.b = $mod.c != "5";',
-    '$mod.b = "6" != $mod.c;',
+    '$mod.b = $mod.c === "1";',
+    '$mod.b = "2" === $mod.c;',
+    '$mod.b = "3" === "4";',
+    '$mod.b = $mod.c !== "5";',
+    '$mod.b = "6" !== $mod.c;',
     '$mod.b = $mod.c > "7";',
     '$mod.b = $mod.c > "7";',
     '$mod.b = "8" > $mod.c;',
     '$mod.b = "8" > $mod.c;',
     '$mod.b = $mod.c >= "9";',
     '$mod.b = $mod.c >= "9";',
@@ -3979,8 +3979,8 @@ begin
     'this.b =false;'
     'this.b =false;'
     ]),
     ]),
     LinesToStr([ // this.$main
     LinesToStr([ // this.$main
-    '$mod.b = $mod.s == $mod.t;',
-    '$mod.b = $mod.s != $mod.t;',
+    '$mod.b = $mod.s === $mod.t;',
+    '$mod.b = $mod.s !== $mod.t;',
     '$mod.b = $mod.s > $mod.t;',
     '$mod.b = $mod.s > $mod.t;',
     '$mod.b = $mod.s >= $mod.t;',
     '$mod.b = $mod.s >= $mod.t;',
     '$mod.b = $mod.s < $mod.t;',
     '$mod.b = $mod.s < $mod.t;',
@@ -4037,9 +4037,9 @@ begin
     'this.b = false;'
     'this.b = false;'
     ]),
     ]),
     LinesToStr([ // this.$main
     LinesToStr([ // this.$main
-    '$mod.b = $mod.s.charAt(1-1) == $mod.c;',
-    '$mod.b = $mod.c == $mod.s.charAt(1 - 1);',
-    '$mod.b = $mod.c != $mod.s.charAt(1 - 1);',
+    '$mod.b = $mod.s.charAt(1-1) === $mod.c;',
+    '$mod.b = $mod.c === $mod.s.charAt(1 - 1);',
+    '$mod.b = $mod.c !== $mod.s.charAt(1 - 1);',
     '$mod.b = $mod.c > $mod.s.charAt(1 - 1);',
     '$mod.b = $mod.c > $mod.s.charAt(1 - 1);',
     '$mod.b = $mod.c >= $mod.s.charAt(1 - 1);',
     '$mod.b = $mod.c >= $mod.s.charAt(1 - 1);',
     '$mod.b = $mod.c < $mod.s.charAt(1 - 1);',
     '$mod.b = $mod.c < $mod.s.charAt(1 - 1);',
@@ -4330,7 +4330,7 @@ begin
     '  var $loopend1 = 2;',
     '  var $loopend1 = 2;',
     '  for ($mod.vI = 1; $mod.vI <= $loopend1; $mod.vI++);',
     '  for ($mod.vI = 1; $mod.vI <= $loopend1; $mod.vI++);',
     '  if($mod.vI>$loopend1)$mod.vI--;',
     '  if($mod.vI>$loopend1)$mod.vI--;',
-    '  if ($mod.vI==3) ;'
+    '  if ($mod.vI===3) ;'
     ]));
     ]));
 end;
 end;
 
 
@@ -4415,10 +4415,10 @@ begin
   Add('begin');
   Add('begin');
   Add('  vi:=1;');
   Add('  vi:=1;');
   Add('  asm');
   Add('  asm');
-  Add('    if (vI==1) {');
+  Add('    if (vI===1) {');
   Add('      vI=2;');
   Add('      vI=2;');
   Add('    }');
   Add('    }');
-  Add('    if (vI==2){ vI=3; }');
+  Add('    if (vI===2){ vI=3; }');
   Add('  end;');
   Add('  end;');
   Add('  VI:=4;');
   Add('  VI:=4;');
   ConvertProgram;
   ConvertProgram;
@@ -4428,10 +4428,10 @@ begin
     ]),
     ]),
     LinesToStr([ // $mod.$main
     LinesToStr([ // $mod.$main
     '$mod.vI = 1;',
     '$mod.vI = 1;',
-    'if (vI==1) {',
+    'if (vI===1) {',
     '  vI=2;',
     '  vI=2;',
     '}',
     '}',
-    'if (vI==2){ vI=3; }',
+    'if (vI===2){ vI=3; }',
     ';',
     ';',
     '$mod.vI = 4;'
     '$mod.vI = 4;'
     ]));
     ]));
@@ -4572,7 +4572,7 @@ begin
     '    throw $e',
     '    throw $e',
     '  } else if ($mod.Exception.isPrototypeOf($e)) {',
     '  } else if ($mod.Exception.isPrototypeOf($e)) {',
     '    var E = $e;',
     '    var E = $e;',
-    '    if (E.Msg == "") throw E;',
+    '    if (E.Msg === "") throw E;',
     '  } else {',
     '  } else {',
     '    $mod.vI = 5;',
     '    $mod.vI = 5;',
     '  }',
     '  }',
@@ -4604,7 +4604,7 @@ begin
     ]),
     ]),
     LinesToStr([ // $mod.$main
     LinesToStr([ // $mod.$main
     'var $tmp1 = $mod.vI;',
     'var $tmp1 = $mod.vI;',
-    'if ($tmp1 == 1) {} else if ($tmp1 == 2){ $mod.vI = 3 }else {',
+    'if ($tmp1 === 1) {} else if ($tmp1 === 2){ $mod.vI = 3 }else {',
     '  $mod.vI = 4;',
     '  $mod.vI = 4;',
     '};'
     '};'
     ]));
     ]));
@@ -4655,7 +4655,7 @@ begin
     ]),
     ]),
     LinesToStr([ // $mod.$main
     LinesToStr([ // $mod.$main
     'var $tmp1 = $mod.Vi;',
     'var $tmp1 = $mod.Vi;',
-    'if ($tmp1 == 1) {',
+    'if ($tmp1 === 1) {',
     '  $mod.Vi = 2;',
     '  $mod.Vi = 2;',
     '  $mod.Vi = 3;',
     '  $mod.Vi = 3;',
     '};'
     '};'
@@ -4706,7 +4706,7 @@ begin
     'var $tmp1 = $mod.vI;',
     'var $tmp1 = $mod.vI;',
     'if (($tmp1 >= 1) && ($tmp1 <= 3)){',
     'if (($tmp1 >= 1) && ($tmp1 <= 3)){',
     '  $mod.vI = 14',
     '  $mod.vI = 14',
-    '} else if (($tmp1 == 4) || ($tmp1 == 5)){',
+    '} else if (($tmp1 === 4) || ($tmp1 === 5)){',
     '  $mod.vI = 16',
     '  $mod.vI = 16',
     '} else if ((($tmp1 >= 6) && ($tmp1 <= 7)) || (($tmp1 >= 9) && ($tmp1 <= 10))) ;'
     '} else if ((($tmp1 >= 6) && ($tmp1 <= 7)) || (($tmp1 >= 9) && ($tmp1 <= 10))) ;'
     ]));
     ]));
@@ -4773,8 +4773,8 @@ begin
     ]),
     ]),
     LinesToStr([ // $mod.$main
     LinesToStr([ // $mod.$main
     '$mod.Arr = [];',
     '$mod.Arr = [];',
-    'if (rtl.length($mod.Arr) == 0) ;',
-    'if (rtl.length($mod.Arr) == 0) ;',
+    'if (rtl.length($mod.Arr) === 0) ;',
+    'if (rtl.length($mod.Arr) === 0) ;',
     'if (rtl.length($mod.Arr) > 0) ;',
     'if (rtl.length($mod.Arr) > 0) ;',
     'if (rtl.length($mod.Arr) > 0) ;',
     'if (rtl.length($mod.Arr) > 0) ;',
     '$mod.DoIt([],[]);',
     '$mod.DoIt([],[]);',
@@ -4815,8 +4815,8 @@ begin
     ]),
     ]),
     LinesToStr([ // $mod.$main
     LinesToStr([ // $mod.$main
     '$mod.Arr2 = [];',
     '$mod.Arr2 = [];',
-    'if (rtl.length($mod.Arr2) == 0) ;',
-    'if (rtl.length($mod.Arr2) == 0) ;',
+    'if (rtl.length($mod.Arr2) === 0) ;',
+    'if (rtl.length($mod.Arr2) === 0) ;',
     '$mod.i = 0;',
     '$mod.i = 0;',
     '$mod.i = 0;',
     '$mod.i = 0;',
     '$mod.i = rtl.length($mod.Arr2) - 1;',
     '$mod.i = rtl.length($mod.Arr2) - 1;',
@@ -4862,7 +4862,7 @@ begin
     '    this.Int = 0;',
     '    this.Int = 0;',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return this.Int == b.Int;',
+    '    return this.Int === b.Int;',
     '  };',
     '  };',
     '};',
     '};',
     'this.Arr = [];',
     'this.Arr = [];',
@@ -5227,7 +5227,7 @@ begin
     '    this.i = 0;',
     '    this.i = 0;',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return this.i == b.i;',
+    '    return this.i === b.i;',
     '  };',
     '  };',
     '};',
     '};',
     'this.ArrInt = [];',
     'this.ArrInt = [];',
@@ -5299,7 +5299,7 @@ begin
     '    this.i = 0;',
     '    this.i = 0;',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return this.i == b.i;',
+    '    return this.i === b.i;',
     '  };',
     '  };',
     '};',
     '};',
     'this.ArrInt = [];',
     'this.ArrInt = [];',
@@ -5369,7 +5369,7 @@ begin
     '    this.i = 0;',
     '    this.i = 0;',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return this.i == b.i;',
+    '    return this.i === b.i;',
     '  };',
     '  };',
     '};',
     '};',
     'this.ArrInt = [];',
     'this.ArrInt = [];',
@@ -5494,7 +5494,7 @@ begin
     '    this.Bold = 0;',
     '    this.Bold = 0;',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return this.Bold == b.Bold;',
+    '    return this.Bold === b.Bold;',
     '  };',
     '  };',
     '};',
     '};',
     'this.Rec = new $mod.TRecA();'
     'this.Rec = new $mod.TRecA();'
@@ -5531,7 +5531,7 @@ begin
     '    this.vI = 0;',
     '    this.vI = 0;',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return this.vI == b.vI;',
+    '    return this.vI === b.vI;',
     '  };',
     '  };',
     '};',
     '};',
     'this.Int = 0;',
     'this.Int = 0;',
@@ -5582,7 +5582,7 @@ begin
     '    this.N = 0;',
     '    this.N = 0;',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return this.N == b.N;',
+    '    return this.N === b.N;',
     '  };',
     '  };',
     '};',
     '};',
     'this.TBigRec = function (s) {',
     'this.TBigRec = function (s) {',
@@ -5600,7 +5600,7 @@ begin
     '    this.Enums = {};',
     '    this.Enums = {};',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return (this.Int == b.Int) && ((this.D == b.D) && ((this.Arr == b.Arr)',
+    '    return (this.Int === b.Int) && ((this.D === b.D) && ((this.Arr === b.Arr)',
     ' && (this.Small.$equal(b.Small) && rtl.eqSet(this.Enums, b.Enums))));',
     ' && (this.Small.$equal(b.Small) && rtl.eqSet(this.Enums, b.Enums))));',
     '  };',
     '  };',
     '};',
     '};',
@@ -5635,7 +5635,7 @@ begin
     '    this.Bold = 0;',
     '    this.Bold = 0;',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return this.Bold == b.Bold;',
+    '    return this.Bold === b.Bold;',
     '  };',
     '  };',
     '};',
     '};',
     'this.DoDefault = function (r) {',
     'this.DoDefault = function (r) {',
@@ -5682,7 +5682,7 @@ begin
     '    this.i = 0;',
     '    this.i = 0;',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return this.i == b.i;',
+    '    return this.i === b.i;',
     '  };',
     '  };',
     '};',
     '};',
     'this.DoIt = function (vG,vH,vI) {',
     'this.DoIt = function (vG,vH,vI) {',
@@ -5757,7 +5757,7 @@ begin
     '    this.i = 0;',
     '    this.i = 0;',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return this.i == b.i;',
+    '    return this.i === b.i;',
     '  };',
     '  };',
     '};',
     '};',
     'this.DoIt = function (vG,vH,vI) {',
     'this.DoIt = function (vG,vH,vI) {',
@@ -5815,7 +5815,7 @@ begin
     '    this.i = 0;',
     '    this.i = 0;',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return this.i == b.i;',
+    '    return this.i === b.i;',
     '  };',
     '  };',
     '};',
     '};',
     'this.GetRec = function (vB) {',
     'this.GetRec = function (vB) {',
@@ -5857,7 +5857,7 @@ begin
     '    this.i = 0;',
     '    this.i = 0;',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return this.i == b.i;',
+    '    return this.i === b.i;',
     '  };',
     '  };',
     '};',
     '};',
     'this.DoIt = function (vG,vH,vI) {',
     'this.DoIt = function (vG,vH,vI) {',
@@ -5920,7 +5920,7 @@ begin
     '    this.f = {};',
     '    this.f = {};',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  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) {',
     'this.TNested = function (s) {',
@@ -5965,7 +5965,7 @@ begin
     '    this.i = 0;',
     '    this.i = 0;',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return this.i == b.i;',
+    '    return this.i === b.i;',
     '  };',
     '  };',
     '};',
     '};',
     'this.Jv = undefined;',
     'this.Jv = undefined;',
@@ -6590,7 +6590,7 @@ begin
     LinesToStr([ // $mod.$main
     LinesToStr([ // $mod.$main
     '$mod.Obj = $mod.TObject.$create("Create");',
     '$mod.Obj = $mod.TObject.$create("Create");',
     '$mod.TObject.vI = 3;',
     '$mod.TObject.vI = 3;',
-    'if ($mod.TObject.vI == 4);',
+    'if ($mod.TObject.vI === 4);',
     '$mod.TObject.Sub=null;',
     '$mod.TObject.Sub=null;',
     '$mod.Obj.$class.Sub=null;',
     '$mod.Obj.$class.Sub=null;',
     '$mod.Obj.Sub.$class.Sub=null;',
     '$mod.Obj.Sub.$class.Sub=null;',
@@ -6736,7 +6736,7 @@ begin
     '    return Result;',
     '    return Result;',
     '  };',
     '  };',
     '  this.SetInt = function (Value) {',
     '  this.SetInt = function (Value) {',
-    '    if (Value == this.Fy) return;',
+    '    if (Value === this.Fy) return;',
     '    this.Fy = Value;',
     '    this.Fy = Value;',
     '  };',
     '  };',
     '  this.DoIt = function () {',
     '  this.DoIt = function () {',
@@ -6750,7 +6750,7 @@ begin
     ]),
     ]),
     LinesToStr([ // $mod.$main
     LinesToStr([ // $mod.$main
     '$mod.Obj.Fy = $mod.Obj.Fx + 1;',
     '$mod.Obj.Fy = $mod.Obj.Fx + 1;',
-    'if ($mod.Obj.GetInt() == 2);',
+    'if ($mod.Obj.GetInt() === 2);',
     '$mod.Obj.SetInt($mod.Obj.GetInt() + 2);',
     '$mod.Obj.SetInt($mod.Obj.GetInt() + 2);',
     '$mod.Obj.SetInt($mod.Obj.Fx);'
     '$mod.Obj.SetInt($mod.Obj.Fx);'
     ]));
     ]));
@@ -6821,11 +6821,11 @@ begin
     ]),
     ]),
     LinesToStr([ // $mod.$main
     LinesToStr([ // $mod.$main
     '$mod.TObject.Fy = $mod.TObject.Fx + 1;',
     '$mod.TObject.Fy = $mod.TObject.Fx + 1;',
-    'if ($mod.TObject.GetInt() == 2);',
+    'if ($mod.TObject.GetInt() === 2);',
     '$mod.TObject.SetInt($mod.TObject.GetInt() + 2);',
     '$mod.TObject.SetInt($mod.TObject.GetInt() + 2);',
     '$mod.TObject.SetInt($mod.TObject.Fx);',
     '$mod.TObject.SetInt($mod.TObject.Fx);',
     '$mod.Obj.$class.Fy = $mod.Obj.Fx + 1;',
     '$mod.Obj.$class.Fy = $mod.Obj.Fx + 1;',
-    'if ($mod.Obj.$class.GetInt() == 2);',
+    'if ($mod.Obj.$class.GetInt() === 2);',
     '$mod.Obj.$class.SetInt($mod.Obj.$class.GetInt() + 2);',
     '$mod.Obj.$class.SetInt($mod.Obj.$class.GetInt() + 2);',
     '$mod.Obj.$class.SetInt($mod.Obj.Fx);'
     '$mod.Obj.$class.SetInt($mod.Obj.Fx);'
     ]));
     ]));
@@ -7090,8 +7090,8 @@ begin
     'this.b = false;'
     'this.b = false;'
     ]),
     ]),
     LinesToStr([ // $mod.$main
     LinesToStr([ // $mod.$main
-    'if ($mod.Obj != null);',
-    '$mod.b = ($mod.Obj != null) || false;'
+    'if ($mod.Obj !== null);',
+    '$mod.b = ($mod.Obj !== null) || false;'
     ]));
     ]));
 end;
 end;
 
 
@@ -7442,18 +7442,18 @@ begin
     'this.ProcA = function (A) {',
     'this.ProcA = function (A) {',
     '  A.set(null);',
     '  A.set(null);',
     '  A.set(A.get());',
     '  A.set(A.get());',
-    '  if (A.get() == null);',
-    '  if (null == A.get());',
+    '  if (A.get() === null);',
+    '  if (null === A.get());',
     '};',
     '};',
     'this.ProcB = function (A) {',
     'this.ProcB = function (A) {',
     '  A.set(null);',
     '  A.set(null);',
     '  A.set(A.get());',
     '  A.set(A.get());',
-    '  if (A.get() == null);',
-    '  if (null == A.get());',
+    '  if (A.get() === null);',
+    '  if (null === A.get());',
     '};',
     '};',
     'this.ProcC = function (A) {',
     'this.ProcC = function (A) {',
-    '  if (A == null);',
-    '  if (null == A);',
+    '  if (A === null);',
+    '  if (null === A);',
     '};',
     '};',
     'this.o = null;',
     'this.o = null;',
     '']),
     '']),
@@ -7948,35 +7948,35 @@ begin
     '  this.$final = function () {',
     '  this.$final = function () {',
     '  };',
     '  };',
     '  this.DoIt = function () {',
     '  this.DoIt = function () {',
-    '    if (this.cI == 4) ;',
-    '    if (5 == this.cI) ;',
-    '    if (this.cI == 6) ;',
-    '    if (7 == this.cI) ;',
-    '    if (this.cI == 11) ;',
-    '    if (12 == this.cI) ;',
+    '    if (this.cI === 4) ;',
+    '    if (5 === this.cI) ;',
+    '    if (this.cI === 6) ;',
+    '    if (7 === this.cI) ;',
+    '    if (this.cI === 11) ;',
+    '    if (12 === this.cI) ;',
     '  };',
     '  };',
     '  this.DoMore = function () {',
     '  this.DoMore = function () {',
-    '    if (this.cI == 8) ;',
-    '    if (this.cI == 9) ;',
-    '    if (10 == this.cI) ;',
-    '    if (11 == this.cI) ;',
-    '    if (this.cI == 13) ;',
-    '    if (14 == this.cI) ;',
+    '    if (this.cI === 8) ;',
+    '    if (this.cI === 9) ;',
+    '    if (10 === this.cI) ;',
+    '    if (11 === this.cI) ;',
+    '    if (this.cI === 13) ;',
+    '    if (14 === this.cI) ;',
     '  };',
     '  };',
     '});',
     '});',
     'this.Obj = null;',
     'this.Obj = null;',
     'this.Cla = null;',
     'this.Cla = null;',
     '']),
     '']),
     LinesToStr([
     LinesToStr([
-    'if ($mod.TObject.cI == 21) ;',
-    'if ($mod.Obj.cI == 22) ;',
-    'if ($mod.Cla.cI == 23) ;',
+    'if ($mod.TObject.cI === 21) ;',
+    'if ($mod.Obj.cI === 22) ;',
+    'if ($mod.Cla.cI === 23) ;',
     'var $with1 = $mod.Obj;',
     'var $with1 = $mod.Obj;',
-    'if ($with1.cI == 24) ;',
+    'if ($with1.cI === 24) ;',
     'var $with2 = $mod.TObject;',
     'var $with2 = $mod.TObject;',
-    'if ($with2.cI == 25) ;',
+    'if ($with2.cI === 25) ;',
     'var $with3 = $mod.Cla;',
     'var $with3 = $mod.Cla;',
-    'if ($with3.cI == 26) ;',
+    'if ($with3.cI === 26) ;',
     '']));
     '']));
 end;
 end;
 
 
@@ -8578,18 +8578,18 @@ begin
     'this.C = null;'
     'this.C = null;'
     ]),
     ]),
     LinesToStr([ // $mod.$main
     LinesToStr([ // $mod.$main
-    '$mod.b = $mod.C == null;',
-    '$mod.b = null == $mod.C;',
-    '$mod.b = $mod.C == $mod.Obj.ClassType;',
-    '$mod.b = $mod.Obj.ClassType == $mod.C;',
-    '$mod.b = $mod.C == $mod.TObject;',
-    '$mod.b = $mod.TObject == $mod.C;',
-    '$mod.b = $mod.C != null;',
-    '$mod.b = null != $mod.C;',
-    '$mod.b = $mod.C != $mod.Obj.ClassType;',
-    '$mod.b = $mod.Obj.ClassType != $mod.C;',
-    '$mod.b = $mod.C != $mod.TObject;',
-    '$mod.b = $mod.TObject != $mod.C;',
+    '$mod.b = $mod.C === null;',
+    '$mod.b = null === $mod.C;',
+    '$mod.b = $mod.C === $mod.Obj.ClassType;',
+    '$mod.b = $mod.Obj.ClassType === $mod.C;',
+    '$mod.b = $mod.C === $mod.TObject;',
+    '$mod.b = $mod.TObject === $mod.C;',
+    '$mod.b = $mod.C !== null;',
+    '$mod.b = null !== $mod.C;',
+    '$mod.b = $mod.C !== $mod.Obj.ClassType;',
+    '$mod.b = $mod.Obj.ClassType !== $mod.C;',
+    '$mod.b = $mod.C !== $mod.TObject;',
+    '$mod.b = $mod.TObject !== $mod.C;',
     '']));
     '']));
 end;
 end;
 
 
@@ -8720,19 +8720,19 @@ begin
     LinesToStr([ // $mod.$main
     LinesToStr([ // $mod.$main
     '$mod.Obj.$class.FA = $mod.Obj.FA;',
     '$mod.Obj.$class.FA = $mod.Obj.FA;',
     '$mod.Obj.$class.SetA($mod.Obj.$class.GetA());',
     '$mod.Obj.$class.SetA($mod.Obj.$class.GetA());',
-    '$mod.b = $mod.Obj.FA == 4;',
-    '$mod.b = $mod.Obj.$class.GetA() == $mod.Obj.$class.GetA();',
-    '$mod.b = 5 == $mod.Obj.FA;',
+    '$mod.b = $mod.Obj.FA === 4;',
+    '$mod.b = $mod.Obj.$class.GetA() === $mod.Obj.$class.GetA();',
+    '$mod.b = 5 === $mod.Obj.FA;',
     '$mod.Cla.FA = 6;',
     '$mod.Cla.FA = 6;',
     '$mod.Cla.FA = $mod.Cla.FA;',
     '$mod.Cla.FA = $mod.Cla.FA;',
     '$mod.Cla.SetA($mod.Cla.GetA());',
     '$mod.Cla.SetA($mod.Cla.GetA());',
-    '$mod.b = $mod.Cla.FA == 7;',
-    '$mod.b = $mod.Cla.GetA() == $mod.Cla.GetA();',
-    '$mod.b = 8 == $mod.Cla.FA;',
+    '$mod.b = $mod.Cla.FA === 7;',
+    '$mod.b = $mod.Cla.GetA() === $mod.Cla.GetA();',
+    '$mod.b = 8 === $mod.Cla.FA;',
     '$mod.TObject.FA = 9;',
     '$mod.TObject.FA = 9;',
     '$mod.TObject.SetA($mod.TObject.GetA());',
     '$mod.TObject.SetA($mod.TObject.GetA());',
-    '$mod.b = $mod.TObject.FA == 10;',
-    '$mod.b = 11 == $mod.TObject.FA;',
+    '$mod.b = $mod.TObject.FA === 10;',
+    '$mod.b = 11 === $mod.TObject.FA;',
     '']));
     '']));
 end;
 end;
 
 
@@ -8765,9 +8765,9 @@ begin
     '  };',
     '  };',
     '  this.ProcA = function () {',
     '  this.ProcA = function () {',
     '    var b = false;',
     '    var b = false;',
-    '    b = this == null;',
-    '    b = this.GlobalId == 3;',
-    '    b = 4 == this.GlobalId;',
+    '    b = this === null;',
+    '    b = this.GlobalId === 3;',
+    '    b = 4 === this.GlobalId;',
     '    this.GlobalId = 5;',
     '    this.GlobalId = 5;',
     '    this.ProcA();',
     '    this.ProcA();',
     '  };',
     '  };',
@@ -10161,18 +10161,18 @@ begin
     '$mod.vP(1);',
     '$mod.vP(1);',
     '$mod.vP(1);',
     '$mod.vP(1);',
     '$mod.vP(2);',
     '$mod.vP(2);',
-    '$mod.b = $mod.vP == null;',
-    '$mod.b = null == $mod.vP;',
+    '$mod.b = $mod.vP === null;',
+    '$mod.b = null === $mod.vP;',
     '$mod.b = rtl.eqCallback($mod.vP,$mod.vQ);',
     '$mod.b = rtl.eqCallback($mod.vP,$mod.vQ);',
     '$mod.b = rtl.eqCallback($mod.vP, $mod.DoIt);',
     '$mod.b = rtl.eqCallback($mod.vP, $mod.DoIt);',
     '$mod.b = rtl.eqCallback($mod.DoIt, $mod.vP);',
     '$mod.b = rtl.eqCallback($mod.DoIt, $mod.vP);',
-    '$mod.b = $mod.vP != null;',
-    '$mod.b = null != $mod.vP;',
+    '$mod.b = $mod.vP !== null;',
+    '$mod.b = null !== $mod.vP;',
     '$mod.b = !rtl.eqCallback($mod.vP,$mod.vQ);',
     '$mod.b = !rtl.eqCallback($mod.vP,$mod.vQ);',
     '$mod.b = !rtl.eqCallback($mod.vP, $mod.DoIt);',
     '$mod.b = !rtl.eqCallback($mod.vP, $mod.DoIt);',
     '$mod.b = !rtl.eqCallback($mod.DoIt, $mod.vP);',
     '$mod.b = !rtl.eqCallback($mod.DoIt, $mod.vP);',
-    '$mod.b = $mod.vP != null;',
-    'if ($mod.vP != null) ;',
+    '$mod.b = $mod.vP !== null;',
+    'if ($mod.vP !== null) ;',
     '']));
     '']));
 end;
 end;
 
 
@@ -10230,19 +10230,19 @@ begin
     '$mod.vP(1);',
     '$mod.vP(1);',
     '$mod.vP(1);',
     '$mod.vP(1);',
     '$mod.vP(2);',
     '$mod.vP(2);',
-    '$mod.b = $mod.vP == null;',
-    '$mod.b = null == $mod.vP;',
+    '$mod.b = $mod.vP === null;',
+    '$mod.b = null === $mod.vP;',
     '$mod.b = rtl.eqCallback($mod.vP,$mod.vQ);',
     '$mod.b = rtl.eqCallback($mod.vP,$mod.vQ);',
     '$mod.b = rtl.eqCallback($mod.vP, $mod.DoIt);',
     '$mod.b = rtl.eqCallback($mod.vP, $mod.DoIt);',
     '$mod.b = rtl.eqCallback($mod.DoIt, $mod.vP);',
     '$mod.b = rtl.eqCallback($mod.DoIt, $mod.vP);',
-    '$mod.b = 4 == $mod.vP(1);',
-    '$mod.b = $mod.vP != null;',
-    '$mod.b = null != $mod.vP;',
+    '$mod.b = 4 === $mod.vP(1);',
+    '$mod.b = $mod.vP !== null;',
+    '$mod.b = null !== $mod.vP;',
     '$mod.b = !rtl.eqCallback($mod.vP,$mod.vQ);',
     '$mod.b = !rtl.eqCallback($mod.vP,$mod.vQ);',
     '$mod.b = !rtl.eqCallback($mod.vP, $mod.DoIt);',
     '$mod.b = !rtl.eqCallback($mod.vP, $mod.DoIt);',
     '$mod.b = !rtl.eqCallback($mod.DoIt, $mod.vP);',
     '$mod.b = !rtl.eqCallback($mod.DoIt, $mod.vP);',
-    '$mod.b = 6 != $mod.vP(1);',
-    '$mod.b = $mod.vP != null;',
+    '$mod.b = 6 !== $mod.vP(1);',
+    '$mod.b = $mod.vP !== null;',
     '$mod.DoIt($mod.vP(1));',
     '$mod.DoIt($mod.vP(1));',
     '$mod.DoIt($mod.vP(2));',
     '$mod.DoIt($mod.vP(2));',
     '']));
     '']));
@@ -10304,13 +10304,13 @@ begin
     '$mod.vP(1);',
     '$mod.vP(1);',
     '$mod.vP(1);',
     '$mod.vP(1);',
     '$mod.vP(2);',
     '$mod.vP(2);',
-    '$mod.b = $mod.vP(1) == $mod.vQ(1);',
-    '$mod.b = $mod.vP(1) == 3;',
-    '$mod.b = 4 == $mod.vP(1);',
-    '$mod.b = $mod.vP(1) != $mod.vQ(1);',
-    '$mod.b = $mod.vP(1) != 5;',
-    '$mod.b = 6 != $mod.vP(1);',
-    '$mod.b = $mod.vP != null;',
+    '$mod.b = $mod.vP(1) === $mod.vQ(1);',
+    '$mod.b = $mod.vP(1) === 3;',
+    '$mod.b = 4 === $mod.vP(1);',
+    '$mod.b = $mod.vP(1) !== $mod.vQ(1);',
+    '$mod.b = $mod.vP(1) !== 5;',
+    '$mod.b = 6 !== $mod.vP(1);',
+    '$mod.b = $mod.vP !== null;',
     '$mod.DoIt($mod.vP(1));',
     '$mod.DoIt($mod.vP(1));',
     '$mod.DoIt($mod.vP(1));',
     '$mod.DoIt($mod.vP(1));',
     '$mod.DoIt($mod.vP(2));',
     '$mod.DoIt($mod.vP(2));',
@@ -10605,12 +10605,12 @@ begin
     '$mod.Obj.FOnFoo(1);',
     '$mod.Obj.FOnFoo(1);',
     '$mod.Obj.GetFoo()(1);',
     '$mod.Obj.GetFoo()(1);',
     '$mod.Obj.GetEvents(6)(1);',
     '$mod.Obj.GetEvents(6)(1);',
-    '$mod.b = $mod.Obj.FOnFoo == null;',
-    '$mod.b = $mod.Obj.GetFoo() == null;',
-    '$mod.b = $mod.Obj.GetEvents(7) == null;',
-    '$mod.b = $mod.Obj.FOnFoo != null;',
-    '$mod.b = $mod.Obj.GetFoo() != null;',
-    '$mod.b = $mod.Obj.GetEvents(8) != null;',
+    '$mod.b = $mod.Obj.FOnFoo === null;',
+    '$mod.b = $mod.Obj.GetFoo() === null;',
+    '$mod.b = $mod.Obj.GetEvents(7) === null;',
+    '$mod.b = $mod.Obj.FOnFoo !== null;',
+    '$mod.b = $mod.Obj.GetFoo() !== null;',
+    '$mod.b = $mod.Obj.GetEvents(8) !== null;',
     '$mod.b = rtl.eqCallback($mod.Obj.FOnFoo, $mod.vP);',
     '$mod.b = rtl.eqCallback($mod.Obj.FOnFoo, $mod.vP);',
     '$mod.b = rtl.eqCallback($mod.Obj.GetFoo(), $mod.vP);',
     '$mod.b = rtl.eqCallback($mod.Obj.GetFoo(), $mod.vP);',
     '$mod.b = rtl.eqCallback($mod.Obj.GetEvents(9), $mod.vP);',
     '$mod.b = rtl.eqCallback($mod.Obj.GetEvents(9), $mod.vP);',
@@ -10626,9 +10626,9 @@ begin
     '$mod.b = !rtl.eqCallback($mod.Obj.FOnFoo, rtl.createCallback($mod.Obj, "DoIt"));',
     '$mod.b = !rtl.eqCallback($mod.Obj.FOnFoo, rtl.createCallback($mod.Obj, "DoIt"));',
     '$mod.b = !rtl.eqCallback($mod.Obj.GetFoo(), rtl.createCallback($mod.Obj, "DoIt"));',
     '$mod.b = !rtl.eqCallback($mod.Obj.GetFoo(), rtl.createCallback($mod.Obj, "DoIt"));',
     '$mod.b = !rtl.eqCallback($mod.Obj.GetEvents(12), rtl.createCallback($mod.Obj, "DoIt"));',
     '$mod.b = !rtl.eqCallback($mod.Obj.GetEvents(12), rtl.createCallback($mod.Obj, "DoIt"));',
-    '$mod.b = $mod.Obj.FOnFoo != null;',
-    '$mod.b = $mod.Obj.GetFoo() != null;',
-    '$mod.b = $mod.Obj.GetEvents(13) != null;',
+    '$mod.b = $mod.Obj.FOnFoo !== null;',
+    '$mod.b = $mod.Obj.GetFoo() !== null;',
+    '$mod.b = $mod.Obj.GetEvents(13) !== null;',
     '']));
     '']));
 end;
 end;
 
 
@@ -10750,15 +10750,15 @@ begin
     '$mod.Obj.FOnFoo(1);',
     '$mod.Obj.FOnFoo(1);',
     '$mod.Obj.GetFoo()(1);',
     '$mod.Obj.GetFoo()(1);',
     '$mod.Obj.GetEvents(6)(1);',
     '$mod.Obj.GetEvents(6)(1);',
-    '$mod.b = $mod.Obj.FOnFoo(1) == $mod.vP(1);',
-    '$mod.b = $mod.Obj.GetFoo() == $mod.vP(1);',
-    '$mod.b = $mod.Obj.FOnFoo(1) == $mod.Obj.FOnFoo(1);',
-    '$mod.b = $mod.Obj.GetFoo() == $mod.Obj.FOnFoo(1);',
-    '$mod.b = $mod.Obj.FOnFoo(1) != $mod.Obj.FOnFoo(1);',
-    '$mod.b = $mod.Obj.GetFoo() != $mod.Obj.FOnFoo(1);',
-    '$mod.b = $mod.Obj.FOnFoo != null;',
-    '$mod.b = $mod.Obj.GetFoo() != null;',
-    '$mod.b = $mod.Obj.GetEvents(13) != null;',
+    '$mod.b = $mod.Obj.FOnFoo(1) === $mod.vP(1);',
+    '$mod.b = $mod.Obj.GetFoo() === $mod.vP(1);',
+    '$mod.b = $mod.Obj.FOnFoo(1) === $mod.Obj.FOnFoo(1);',
+    '$mod.b = $mod.Obj.GetFoo() === $mod.Obj.FOnFoo(1);',
+    '$mod.b = $mod.Obj.FOnFoo(1) !== $mod.Obj.FOnFoo(1);',
+    '$mod.b = $mod.Obj.GetFoo() !== $mod.Obj.FOnFoo(1);',
+    '$mod.b = $mod.Obj.FOnFoo !== null;',
+    '$mod.b = $mod.Obj.GetFoo() !== null;',
+    '$mod.b = $mod.Obj.GetEvents(13) !== null;',
     '']));
     '']));
 end;
 end;
 
 
@@ -10869,12 +10869,12 @@ begin
     '$with1.FOnFoo(1);',
     '$with1.FOnFoo(1);',
     '$with1.FOnFoo(1);',
     '$with1.FOnFoo(1);',
     '$with1.GetFoo()(1);',
     '$with1.GetFoo()(1);',
-    '$mod.b = $with1.FOnFoo == null;',
-    '$mod.b = $with1.FOnFoo == null;',
-    '$mod.b = $with1.GetFoo() == null;',
-    '$mod.b = $with1.FOnFoo != null;',
-    '$mod.b = $with1.FOnFoo != null;',
-    '$mod.b = $with1.GetFoo() != null;',
+    '$mod.b = $with1.FOnFoo === null;',
+    '$mod.b = $with1.FOnFoo === null;',
+    '$mod.b = $with1.GetFoo() === null;',
+    '$mod.b = $with1.FOnFoo !== null;',
+    '$mod.b = $with1.FOnFoo !== null;',
+    '$mod.b = $with1.GetFoo() !== null;',
     '$mod.b = rtl.eqCallback($with1.FOnFoo, $mod.vP);',
     '$mod.b = rtl.eqCallback($with1.FOnFoo, $mod.vP);',
     '$mod.b = rtl.eqCallback($with1.FOnFoo, $mod.vP);',
     '$mod.b = rtl.eqCallback($with1.FOnFoo, $mod.vP);',
     '$mod.b = rtl.eqCallback($with1.GetFoo(), $mod.vP);',
     '$mod.b = rtl.eqCallback($with1.GetFoo(), $mod.vP);',
@@ -10890,9 +10890,9 @@ begin
     '$mod.b = !rtl.eqCallback($with1.FOnFoo, rtl.createCallback($with1, "DoIt"));',
     '$mod.b = !rtl.eqCallback($with1.FOnFoo, rtl.createCallback($with1, "DoIt"));',
     '$mod.b = !rtl.eqCallback($with1.FOnFoo, rtl.createCallback($with1, "DoIt"));',
     '$mod.b = !rtl.eqCallback($with1.FOnFoo, rtl.createCallback($with1, "DoIt"));',
     '$mod.b = !rtl.eqCallback($with1.GetFoo(), rtl.createCallback($with1, "DoIt"));',
     '$mod.b = !rtl.eqCallback($with1.GetFoo(), rtl.createCallback($with1, "DoIt"));',
-    '$mod.b = $with1.FOnFoo != null;',
-    '$mod.b = $with1.FOnFoo != null;',
-    '$mod.b = $with1.GetFoo() != null;',
+    '$mod.b = $with1.FOnFoo !== null;',
+    '$mod.b = $with1.FOnFoo !== null;',
+    '$mod.b = $with1.GetFoo() !== null;',
     '']));
     '']));
 end;
 end;
 
 
@@ -11308,9 +11308,9 @@ begin
     LinesToStr([ // $mod.$main
     LinesToStr([ // $mod.$main
     '$mod.p = $mod.p;',
     '$mod.p = $mod.p;',
     '$mod.p = null;',
     '$mod.p = null;',
-    'if ($mod.p == null) ;',
-    'if (null == $mod.p) ;',
-    'if ($mod.p != null) ;',
+    'if ($mod.p === null) ;',
+    'if (null === $mod.p) ;',
+    'if ($mod.p !== null) ;',
     '$mod.p = $mod.v;',
     '$mod.p = $mod.v;',
     '$mod.p = $mod.Obj;',
     '$mod.p = $mod.Obj;',
     '$mod.p = $mod.C;',
     '$mod.p = $mod.C;',
@@ -11808,8 +11808,8 @@ begin
     '$mod.Arr[0] = rtl.length($mod.TheArray) - 1;',
     '$mod.Arr[0] = rtl.length($mod.TheArray) - 1;',
     '$mod.Arr = $mod.ArrInt;',
     '$mod.Arr = $mod.ArrInt;',
     '$mod.ArrInt = $mod.Arr;',
     '$mod.ArrInt = $mod.Arr;',
-    'if (rtl.length($mod.TheArray) == 0) ;',
-    'if (rtl.length($mod.TheArray) == 0) ;',
+    'if (rtl.length($mod.TheArray) === 0) ;',
+    'if (rtl.length($mod.TheArray) === 0) ;',
     'if (rtl.length($mod.TheArray) > 0) ;',
     'if (rtl.length($mod.TheArray) > 0) ;',
     'if (rtl.length($mod.TheArray) > 0) ;',
     'if (rtl.length($mod.TheArray) > 0) ;',
     '']));
     '']));
@@ -13270,7 +13270,7 @@ begin
     '    this.y = 0;',
     '    this.y = 0;',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return (this.x == b.x) && (this.y == b.y);',
+    '    return (this.x === b.x) && (this.y === b.y);',
     '  };',
     '  };',
     '};',
     '};',
     '$mod.$rtti.$Record("TPoint", {}).addFields("x", rtl.longint, "y", rtl.longint);',
     '$mod.$rtti.$Record("TPoint", {}).addFields("x", rtl.longint, "y", rtl.longint);',
@@ -13310,7 +13310,7 @@ begin
     '      this.y = 0;',
     '      this.y = 0;',
     '    };',
     '    };',
     '    this.$equal = function (b) {',
     '    this.$equal = function (b) {',
-    '      return (this.x == b.x) && (this.y == b.y);',
+    '      return (this.x === b.x) && (this.y === b.y);',
     '    };',
     '    };',
     '  };',
     '  };',
     '};',
     '};',

+ 1 - 1
packages/pastojs/tests/tcoptimizations.pas

@@ -372,7 +372,7 @@ begin
     '    this.a = 0;',
     '    this.a = 0;',
     '  };',
     '  };',
     '  this.$equal = function (b) {',
     '  this.$equal = function (b) {',
-    '    return this.a == b.a;',
+    '    return this.a === b.a;',
     '  };',
     '  };',
     '};',
     '};',
     'this.r = new $mod.TRec();',
     'this.r = new $mod.TRec();',