我正在阅读JavaScriptCore的源代码,不久后我偶然发现了这一点。代码有点合理,但是使用'@'时会发生什么呢?
[...]
if (@isArray(currentElement)) {
constructor = currentElement.constructor;
[...]
if (@isArrayConstructor(constructor) && @Array !== constructor)
constructor = @undefined;
else if (@isObject(constructor)) {
constructor = constructor.@speciesSymbol;
if (constructor === null)
constructor = @Array;
}
}
[...]
答案 0 :(得分:1)
我自己找到了答案。正如@ p-s-w-g所指出的那样,它们是装饰器。我正在寻找的对象的定义可以在以下位置找到: webkit / Source / JavaScriptCore / runtime / ArrayConstructor.h
inline bool isArray(ExecState* exec, JSValue argumentValue)
{
if (!argumentValue.isObject())
return false;
JSObject* argument = jsCast<JSObject*>(argumentValue);
if (argument->type() == ArrayType || argument->type() == DerivedArrayType)
return true;
if (argument->type() != ProxyObjectType)
return false;
return isArraySlow(exec, jsCast<ProxyObject*>(argument));
}