Explorar el Código

pas2js:: rtl.js: add Math.trunc only if used

git-svn-id: trunk@38059 -
Mattias Gaertner hace 7 años
padre
commit
898b566837

+ 1 - 0
packages/pastojs/src/fppas2js.pp

@@ -277,6 +277,7 @@ Works:
   - procedure argument int
   - procedure argument int
 
 
 ToDos:
 ToDos:
+- 'new', 'Function' -> class var use .prototype
 - btArrayLit
 - btArrayLit
   a: array of jsvalue;
   a: array of jsvalue;
   a:=[];
   a:=[];

+ 2 - 2
packages/pastojs/src/pas2jsfiler.pp

@@ -44,7 +44,7 @@ type
   public
   public
     constructor Create; virtual;
     constructor Create; virtual;
     destructor Destroy; override;
     destructor Destroy; override;
-    procedure WriteModule(aResolver: TPasResolver);
+    procedure WriteModule(aResolver: TPasResolver); virtual;
   end;
   end;
 
 
 implementation
 implementation
@@ -63,7 +63,7 @@ end;
 
 
 procedure TPasToJsFiler.WriteModule(aResolver: TPasResolver);
 procedure TPasToJsFiler.WriteModule(aResolver: TPasResolver);
 begin
 begin
-  if aResolver=nil then ;
+
 end;
 end;
 
 
 end.
 end.

+ 1 - 14
utils/pas2js/dist/rtl.js

@@ -109,18 +109,7 @@ var rtl = {
   },
   },
 
 
   exitcode: 0,
   exitcode: 0,
-  // Create needed polyfills for the rtl to run.
-  
-  createPolyFills : function () {
-    if (!Math.trunc) {
-      Math.trunc = function(v) {
-	v = +v;
-	if (!isFinite(v)) return v;
-	return (v - v % 1) || (v < 0 ? -0 : v === 0 ? v : 0);
-      };
-    }
-  },
-  
+
   run: function(module_name){
   run: function(module_name){
   
   
     function doRun(){
     function doRun(){
@@ -138,8 +127,6 @@ var rtl = {
       }
       }
     }
     }
     
     
-    rtl.createPolyFills();
-    
     if (rtl.showUncaughtExceptions) {
     if (rtl.showUncaughtExceptions) {
       try{
       try{
         doRun();
         doRun();