mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
This removes uses of the "IsWebAssemblyCompiledModule" method, which is deprecated in V8 v8.1 and will be removed in v8.2. We could replace it by "IsWasmModuleObject", but since it's unused in node anyway, I just remove the definition. PR-URL: https://github.com/nodejs/node/pull/32116 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
83 lines
3.5 KiB
C++
83 lines
3.5 KiB
C++
#include "env-inl.h"
|
|
#include "node.h"
|
|
|
|
using v8::Context;
|
|
using v8::FunctionCallbackInfo;
|
|
using v8::Local;
|
|
using v8::Object;
|
|
using v8::Value;
|
|
|
|
namespace node {
|
|
namespace {
|
|
|
|
#define VALUE_METHOD_MAP(V) \
|
|
V(External) \
|
|
V(Date) \
|
|
V(ArgumentsObject) \
|
|
V(BigIntObject) \
|
|
V(BooleanObject) \
|
|
V(NumberObject) \
|
|
V(StringObject) \
|
|
V(SymbolObject) \
|
|
V(NativeError) \
|
|
V(RegExp) \
|
|
V(AsyncFunction) \
|
|
V(GeneratorFunction) \
|
|
V(GeneratorObject) \
|
|
V(Promise) \
|
|
V(Map) \
|
|
V(Set) \
|
|
V(MapIterator) \
|
|
V(SetIterator) \
|
|
V(WeakMap) \
|
|
V(WeakSet) \
|
|
V(ArrayBuffer) \
|
|
V(DataView) \
|
|
V(SharedArrayBuffer) \
|
|
V(Proxy) \
|
|
V(ModuleNamespaceObject) \
|
|
|
|
|
|
#define V(type) \
|
|
static void Is##type(const FunctionCallbackInfo<Value>& args) { \
|
|
args.GetReturnValue().Set(args[0]->Is##type()); \
|
|
}
|
|
|
|
VALUE_METHOD_MAP(V)
|
|
#undef V
|
|
|
|
static void IsAnyArrayBuffer(const FunctionCallbackInfo<Value>& args) {
|
|
args.GetReturnValue().Set(
|
|
args[0]->IsArrayBuffer() || args[0]->IsSharedArrayBuffer());
|
|
}
|
|
|
|
static void IsBoxedPrimitive(const FunctionCallbackInfo<Value>& args) {
|
|
args.GetReturnValue().Set(
|
|
args[0]->IsNumberObject() ||
|
|
args[0]->IsStringObject() ||
|
|
args[0]->IsBooleanObject() ||
|
|
args[0]->IsBigIntObject() ||
|
|
args[0]->IsSymbolObject());
|
|
}
|
|
|
|
void InitializeTypes(Local<Object> target,
|
|
Local<Value> unused,
|
|
Local<Context> context,
|
|
void* priv) {
|
|
Environment* env = Environment::GetCurrent(context);
|
|
|
|
#define V(type) env->SetMethodNoSideEffect(target, \
|
|
"is" #type, \
|
|
Is##type);
|
|
VALUE_METHOD_MAP(V)
|
|
#undef V
|
|
|
|
env->SetMethodNoSideEffect(target, "isAnyArrayBuffer", IsAnyArrayBuffer);
|
|
env->SetMethodNoSideEffect(target, "isBoxedPrimitive", IsBoxedPrimitive);
|
|
}
|
|
|
|
} // anonymous namespace
|
|
} // namespace node
|
|
|
|
NODE_MODULE_CONTEXT_AWARE_INTERNAL(types, node::InitializeTypes)
|