Merge pull request #363 from nofficalfs/PR-Bug-Parsex

[Bug] 兼容修复 | `Event#setContent`及`lib.init.parsex`接纳更多参数
This commit is contained in:
Spmario233 2023-09-21 18:42:21 +08:00 committed by GitHub
commit 7fb14225b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 6 deletions

View File

@ -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){
@ -28744,10 +28751,15 @@
this.content=lib.init.parsex(item);
break;
default:
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;
}