mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 11:09:42 +02:00
* Math.trunc polyfill
git-svn-id: trunk@38051 -
This commit is contained in:
parent
2f3fd73c0d
commit
0ef3fc2f29
18
utils/pas2js/dist/rtl.js
vendored
18
utils/pas2js/dist/rtl.js
vendored
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user