Fix global-await issue

* Print unhandled reject error for developer in shell
* Fix await expression parsing bug

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
Seonghyun Kim 2023-11-30 14:14:29 +09:00 committed by Hyukwoo Park
commit 799bc4fcc9
3 changed files with 10 additions and 1 deletions

View file

@ -1097,6 +1097,11 @@ int main(int argc, char* argv[])
Memory::setGCFrequency(24);
PersistentRefHolder<VMInstanceRef> instance = VMInstanceRef::create();
instance->registerPromiseRejectCallback([](ExecutionStateRef* state, PromiseObjectRef* promise, ValueRef* value, VMInstanceRef::PromiseRejectEvent event) {
if (event == VMInstanceRef::PromiseRejectWithNoHandler) {
fprintf(stderr, "Unhandled promise reject %s:\n", value->toStringWithoutException(state->context())->toStdUTF8String().data());
}
});
PersistentRefHolder<ContextRef> context = createEscargotContext(instance.get());
if (getenv("GC_FREE_SPACE_DIVISOR") && strlen(getenv("GC_FREE_SPACE_DIVISOR"))) {