Implement module import rejection

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
Seonghyun Kim 2021-04-14 16:35:17 +09:00 committed by Hyukwoo Park
commit 1a51cff06d
4 changed files with 15 additions and 9 deletions

View file

@ -607,17 +607,19 @@ static bool evalScript(ContextRef* context, StringRef* source, StringRef* srcNam
puts(evalResult.resultOrErrorToString(context)->toStdUTF8String().data());
}
bool result = true;
while (context->vmInstance()->hasPendingJob()) {
auto jobResult = context->vmInstance()->executePendingJob();
if (shouldPrintScriptResult) {
if (shouldPrintScriptResult || jobResult.error) {
if (jobResult.error) {
fprintf(stderr, "Uncaught %s:\n", jobResult.resultOrErrorToString(context)->toStdUTF8String().data());
result = false;
} else {
fprintf(stderr, "%s\n", jobResult.resultOrErrorToString(context)->toStdUTF8String().data());
}
}
}
return true;
return result;
}
int main(int argc, char* argv[])