1

I was reading JavaScriptCore' s source code and I stumbled upon this after a short while. The code sort of makes sense, but what happens exactly when '@' is used ?

[...]
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;
        }
    }
[...]

I checked this and this but they didn't help much ('@' is not a reserved character in Javascript)

shxdow
  • 31
  • 1
  • 5
  • Possibly related: [What does the at symbol (@) do in ES6 javascript? (ECMAScript 2015)](https://stackoverflow.com/questions/31821084/what-does-the-at-symbol-do-in-es6-javascript-ecmascript-2015) – p.s.w.g Mar 27 '19 at 19:43
  • The first link I posted was probably outdated, hence why I concluded it isn't a keyword. They may be indeed decorators. I can't find where they are defined inside the code base though – shxdow Mar 27 '19 at 20:06

1 Answers1

1

I found the answer myself. As @p-s-w-g pointed out, those are decorators. The defintions for the ones I was looking for can be found in: 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));
}
shxdow
  • 31
  • 1
  • 5