From 631e64a4f2645d2a81de1bc7fde9d3979e3ed2b9 Mon Sep 17 00:00:00 2001 From: Rintim Date: Wed, 20 Sep 2023 14:39:22 +0800 Subject: [PATCH 1/2] handle parsex. --- game/game.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/game/game.js b/game/game.js index 43f0c18b8..e58d63d28 100644 --- a/game/game.js +++ b/game/game.js @@ -10302,8 +10302,14 @@ } } else{ - // TODO: Parse Common Object - throw new Error("NYI: Parse Common Object"); + if(Symbol.iterator in item) return lib.init.parsex(Array.from(item)); + if("toString" in item) return lib.init.parsex(item.toString()); + if("render" in item) { + // TODO: Object Render Parse + throw new Error("NYI: Object Render Parse"); + } + // TODO: Object Other Parse + throw new Error("NYI: Object Other Parse"); } case "function": if (gnc.is.generatorFunc(item)) { @@ -10329,7 +10335,8 @@ else lastEvent=res.value; } } - else return Legacy(item); + default: + return Legacy(item); } }, eval:function(func){ From c31bccdcac1d6196e792ea08a702480f4cfed152 Mon Sep 17 00:00:00 2001 From: Rintim Date: Wed, 20 Sep 2023 14:42:16 +0800 Subject: [PATCH 2/2] observe setContent error. --- game/game.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/game/game.js b/game/game.js index e58d63d28..fbbee71b3 100644 --- a/game/game.js +++ b/game/game.js @@ -28744,9 +28744,14 @@ this.content=lib.init.parsex(item); break; default: - if(!lib.element.content[item]._parsed){ - lib.element.content[item]=lib.init.parsex(lib.element.content[item]); - lib.element.content[item]._parsed=true; + try{ + if(!lib.element.content[item]._parsed){ + lib.element.content[item]=lib.init.parsex(lib.element.content[item]); + lib.element.content[item]._parsed=true; + } + } + catch{ + throw new Error(`Content ${item} may not exist.\nlib.element.content[${item}] = ${lib.element.content[item]}`); } this.content=lib.element.content[item]; break;