reverting new js eval impl

This commit is contained in:
minjaesong
2020-10-28 23:42:55 +09:00
parent 29584b7070
commit 5167bf1034
6 changed files with 16 additions and 11 deletions

View File

@@ -278,9 +278,9 @@ load = undefined;
loadWithNewGlobal = undefined;
exit = undefined;
quit = undefined;
var eval = function(s) { // installing new eval function
/*var eval = function(s) { // this impl is flawed; it does not return any, and cannot alter Global which may not you actually want
return Function('"use strict";return(function(){'+s+'}())')();
}
}*/
//
function javaArrayToJs(jarr) {
if (!jarr.toString.startsWith("[")) return jarr;

View File

@@ -1,8 +1,8 @@
println("TERRAN Megatrends inc.");
//println("Main RAM:"+(system.maxmem() >> 10)+" KBytes");
var memptr = 0;
var memtestptn = [
let memptr = 0;
const memtestptn = [
// Overclockers will LOVE this!
//[0x00,0x00,0x00,0x00 , 0xFF,0xFF,0xFF,0xFF , 0x00,0x00,0x00,0x00 , 0xFF,0xFF,0xFF,0xFF],

5
assets/evaltest.js Normal file
View File

@@ -0,0 +1,5 @@
let src = "var tObj = {}; tObj.testvalue = 'hai'; tObj;"
var testGlobalObject = eval(src);
serial.println(testGlobalObject.testvalue);

View File

@@ -22,7 +22,7 @@ println(ba);
serial.println(getStatusMessage(1));
com.sendMessage(1, "OPENR\"basic.js\"");
com.sendMessage(1, "OPENR\"fsh.js\"");
println("Status code: "+com.getStatusCode(1));

View File

@@ -1422,4 +1422,4 @@ while (!tbasexit) {
}
}
return 0;
0;

View File

@@ -1,10 +1,10 @@
var DOS_VERSION = "1.0";
var PROMPT_TEXT = ">";
var CURRENT_DRIVE = "A";
const DOS_VERSION = "1.0";
const PROMPT_TEXT = ">";
let CURRENT_DRIVE = "A";
var shell_pwd = [""];
let shell_pwd = [""];
var welcome_text = "TSVM Disk Operating System, version " + DOS_VERSION;
const welcome_text = "TSVM Disk Operating System, version " + DOS_VERSION;
function get_prompt_text() {
return CURRENT_DRIVE + ":\\" + shell_pwd.join("\\") + PROMPT_TEXT;