mirror of
https://github.com/oven-sh/bun
synced 2026-02-18 14:51:52 +00:00
Implement vm.compileFunction and fix some node:vm tests (#18285)
This commit is contained in:
@@ -630,6 +630,7 @@ namespace ERR {
|
||||
JSC::EncodedJSValue INVALID_ARG_TYPE(JSC::ThrowScope& throwScope, JSC::JSGlobalObject* globalObject, const WTF::String& arg_name, const WTF::String& expected_type, JSC::JSValue val_actual_value)
|
||||
{
|
||||
auto message = Message::ERR_INVALID_ARG_TYPE(throwScope, globalObject, arg_name, expected_type, val_actual_value);
|
||||
RETURN_IF_EXCEPTION(throwScope, {});
|
||||
throwScope.throwException(globalObject, createError(globalObject, ErrorCode::ERR_INVALID_ARG_TYPE, message));
|
||||
return {};
|
||||
}
|
||||
@@ -641,6 +642,7 @@ JSC::EncodedJSValue INVALID_ARG_TYPE(JSC::ThrowScope& throwScope, JSC::JSGlobalO
|
||||
auto arg_name = jsString->view(globalObject);
|
||||
RETURN_IF_EXCEPTION(throwScope, {});
|
||||
auto message = Message::ERR_INVALID_ARG_TYPE(throwScope, globalObject, arg_name, expected_type, val_actual_value);
|
||||
RETURN_IF_EXCEPTION(throwScope, {});
|
||||
throwScope.throwException(globalObject, createError(globalObject, ErrorCode::ERR_INVALID_ARG_TYPE, message));
|
||||
return {};
|
||||
}
|
||||
@@ -649,10 +651,13 @@ JSC::EncodedJSValue INVALID_ARG_TYPE(JSC::ThrowScope& throwScope, JSC::JSGlobalO
|
||||
JSC::EncodedJSValue INVALID_ARG_INSTANCE(JSC::ThrowScope& throwScope, JSC::JSGlobalObject* globalObject, const WTF::String& arg_name, const WTF::String& expected_type, JSC::JSValue val_actual_value)
|
||||
{
|
||||
auto& vm = JSC::getVM(globalObject);
|
||||
ASCIILiteral type = String(arg_name).contains('.') ? "property"_s : "argument"_s;
|
||||
WTF::StringBuilder builder;
|
||||
builder.append("The \""_s);
|
||||
builder.append(arg_name);
|
||||
builder.append("\" argument must be an instance of "_s);
|
||||
builder.append("\" "_s);
|
||||
builder.append(type);
|
||||
builder.append(" must be an instance of "_s);
|
||||
builder.append(expected_type);
|
||||
builder.append(". Received "_s);
|
||||
determineSpecificType(vm, globalObject, builder, val_actual_value);
|
||||
|
||||
Reference in New Issue
Block a user