|
@@ -109,8 +109,20 @@ var rtl = {
|
|
|
},
|
|
|
|
|
|
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){
|
|
|
+
|
|
|
function doRun(){
|
|
|
if (!rtl.hasString(module_name)) module_name='program';
|
|
|
if (rtl.debug_load_units) rtl.debug('rtl.run module="'+module_name+'"');
|
|
@@ -125,7 +137,9 @@ var rtl = {
|
|
|
if (rtl.isNumber(r)) rtl.exitcode = r;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ rtl.createPolyFills();
|
|
|
+
|
|
|
if (rtl.showUncaughtExceptions) {
|
|
|
try{
|
|
|
doRun();
|