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{ else{
// TODO: Parse Common Object if(Symbol.iterator in item) return lib.init.parsex(Array.from(item));
throw new Error("NYI: Parse Common Object"); 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": case "function":
if (gnc.is.generatorFunc(item)) { if (gnc.is.generatorFunc(item)) {
@ -10329,7 +10335,8 @@
else lastEvent=res.value; else lastEvent=res.value;
} }
} }
else return Legacy(item); default:
return Legacy(item);
} }
}, },
eval:function(func){ eval:function(func){
@ -28744,9 +28751,14 @@
this.content=lib.init.parsex(item); this.content=lib.init.parsex(item);
break; break;
default: default:
if(!lib.element.content[item]._parsed){ try{
lib.element.content[item]=lib.init.parsex(lib.element.content[item]); if(!lib.element.content[item]._parsed){
lib.element.content[item]._parsed=true; 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]; this.content=lib.element.content[item];
break; break;