8#include <private/qv4mm_p.h>
14#include <QtCore/QDateTime>
15#include <QtCore/QStringList>
36 obj->setPrototypeOf(proto);
37 return obj.asReturnedValue();
39 return argv[0].
toObject(v4)->asReturnedValue();
47 return v4->
newObject()->asReturnedValue();
49 return argv[0].
toObject(v4)->asReturnedValue();
82 defineDefaultProperty(v4->
id_toString(), method_toString, 0);
84 defineDefaultProperty(v4->
id_valueOf(), method_valueOf, 0);
85 defineDefaultProperty(
QStringLiteral(
"hasOwnProperty"), method_hasOwnProperty, 1);
86 defineDefaultProperty(
QStringLiteral(
"isPrototypeOf"), method_isPrototypeOf, 1);
87 defineDefaultProperty(
QStringLiteral(
"propertyIsEnumerable"), method_propertyIsEnumerable, 1);
88 defineDefaultProperty(
QStringLiteral(
"__defineGetter__"), method_defineGetter, 2);
89 defineDefaultProperty(
QStringLiteral(
"__defineSetter__"), method_defineSetter, 2);
91 defineAccessorProperty(v4->
id___proto__(), method_get_proto, method_set_proto);
113 return Encode((argv[0].isUndefined() ?
true :
false));
114 return Encode(argv[0].sameValue(argv[1]));
179 return Encode(getOwnPropertyNames(scope.
engine, argv[0]));
197 name =
it.nextPropertyNameAsString();
200 if (!
name->isSymbol())
205 return array->asReturnedValue();
222 for (
int i = 1, ei = argc;
i < ei; ++
i) {
223 if (argv[
i].isUndefined() || argv[
i].isNull())
243 if (!
attrs.isEnumerable())
246 propValue = from->get(nextKey);
258 Scope scope(builtin);
259 if (!argc || (!argv[0].isObject() && !argv[0].isNull()))
265 newObject->setPrototypeOf(O);
268 if (argc > 1 && !argv[1].isUndefined()) {
272 return method_defineProperties(builtin, thisObject,
arguments, argc);
281 if (!argc || !argv[0].isObject())
292 toPropertyDescriptor(scope.
engine, attributes, pd, &
attrs);
296 if (!O->defineOwnProperty(
name, pd,
attrs))
305 if (argc < 2 || !argv[0].isObject())
327 toPropertyDescriptor(scope.
engine,
val,
n, &nattrs);
330 bool ok = O->defineOwnProperty(
key,
n, nattrs);
354 name =
it.nextPropertyNameAsString();
374 return a.asReturnedValue();
382 return a.asReturnedValue();
386 o->setInternalClass(
o->internalClass()->canned());
388 if (
o->arrayData()) {
390 for (
uint i = 0;
i <
o->d()->arrayData->values.alloc; ++
i) {
391 if (!
o->arrayData()->isEmpty(
i))
392 o->d()->arrayData->attrs[
i].setConfigurable(
false);
396 return o.asReturnedValue();
404 return a.asReturnedValue();
412 o->setInternalClass(
o->internalClass()->cryopreserved());
414 if (
o->arrayData()) {
417 if (!
o->arrayData()->isEmpty(
i))
418 o->arrayData()->attrs[
i].setConfigurable(
false);
419 if (
o->arrayData()->attrs[
i].isData())
420 o->arrayData()->attrs[
i].setWritable(
false);
423 return o.asReturnedValue();
436 o->preventExtensions();
437 return o.asReturnedValue();
450 if (
o->isExtensible())
453 if (
o->internalClass() !=
o->internalClass()->canned())
456 if (!
o->arrayData() || !
o->arrayData()->length())
459 Q_ASSERT(
o->arrayData() &&
o->arrayData()->length());
460 if (!
o->arrayData()->attrs)
464 if (!
o->arrayData()->isEmpty(
i))
465 if (
o->arrayData()->attributes(
i).isConfigurable())
482 if (
o->isExtensible())
485 if (!
o->internalClass()->isImplicitlyFrozen())
488 if (!
o->arrayData() || !
o->arrayData()->length())
491 Q_ASSERT(
o->arrayData() &&
o->arrayData()->length());
492 if (!
o->arrayData()->attrs)
496 if (!
o->arrayData()->isEmpty(
i))
497 if (
o->arrayData()->attributes(
i).isConfigurable() ||
o->arrayData()->attributes(
i).isWritable())
514 return Encode((
bool)
o->isExtensible());
539 return a.asReturnedValue();
545 if (argc < 2 || argv[0].isNullOrUndefined() || !(argv[1].isObject() || argv[1].isNull()))
548 if (!argv[0].isObject())
553 bool ok =
o->setPrototypeOf(
p);
556 return o->asReturnedValue();
584 return a.asReturnedValue();
593 }
else if (thisObject->
isNull()) {
613 name = toStringTag->toQString();
655 if (!argc || !argv[0].isObject())
664 if (O->d() == proto->d())
666 proto = proto->getPrototypeOf();
752 return Encode(
o->getPrototypeOf());
759 if (!
o || !argc || (!argv[0].isObject() && !argv[0].isNull()))
763 bool ok =
o->setPrototypeOf(
p);
784 if (
o->hasProperty(
engine->id_enumerable()->toPropertyKey()))
785 attrs->setEnumerable((tmp =
o->get(
engine->id_enumerable()))->toBoolean());
787 if (
o->hasProperty(
engine->id_configurable()->toPropertyKey()))
788 attrs->setConfigurable((tmp =
o->get(
engine->id_configurable()))->toBoolean());
790 if (
o->hasProperty(
engine->id_get()->toPropertyKey())) {
793 if (
f ||
get->isUndefined()) {
802 if (
o->hasProperty(
engine->id_set()->toPropertyKey())) {
805 if (
f ||
set->isUndefined()) {
814 if (
o->hasProperty(
engine->id_writable()->toPropertyKey())) {
815 if (
attrs->isAccessor()) {
819 attrs->setWritable((tmp =
o->get(
engine->id_writable()))->toBoolean());
822 if (
o->hasProperty(
engine->id_value()->toPropertyKey())) {
823 if (
attrs->isAccessor()) {
831 if (
attrs->isGeneric())
848 if (
attrs.isData()) {
869 return o.asReturnedValue();
882 name =
it.nextPropertyNameAsString();
885 if (
name->isSymbol())
QJSValue newObject()
Creates a JavaScript object of class Object.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QSet< QString >::iterator it
QList< QVariant > arguments
\qmltype Particle \inqmlmodule QtQuick.Particles
ReturnedValue checkedResult(QV4::ExecutionEngine *v4, ReturnedValue result)
static QDBusError::ErrorType get(const char *name)
static struct AttrInfo attrs[]
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLsizei GLsizei GLint * values
[15]
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLenum GLsizei length
GLsizei const GLchar *const * string
[0]
#define QStringLiteral(str)
#define CHECK_STACK_LIMITS(v4)
#define THROW_TYPE_ERROR()
#define RETURN_UNDEFINED()
#define DEFINE_OBJECT_VTABLE(classname)
QFuture< QSet< QChar > > set
[10]
static bool isNonStrictArgumentsObject(Managed *m)
static void ensureAttributes(Object *o)
static constexpr ReturnedValue undefined()
static constexpr ReturnedValue null()
Heap::String * newString(const QString &s=QString())
Object * stringPrototype() const
String * id_length() const
String * id_toString() const
String * id_prototype() const
Object * numberPrototype() const
Heap::Object * newObject()
String * id___proto__() const
String * id_toLocaleString() const
Symbol * symbol_toStringTag() const
Object * booleanPrototype() const
Object * symbolPrototype() const
Heap::ArrayObject * newArrayObject(int count=0)
String * id_valueOf() const
ReturnedValue throwTypeError()
Heap::ExecutionContext * scope() const
void init(QV4::ExecutionContext *scope)
static ReturnedValue method_defineProperties(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_toLocaleString(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_set_proto(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_propertyIsEnumerable(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_entries(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_getOwnPropertyNames(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_getOwnPropertyDescriptor(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_defineProperty(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_getPrototypeOf(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_create(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_getOwnPropertyDescriptors(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_hasOwnProperty(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_seal(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static void toPropertyDescriptor(ExecutionEngine *engine, const Value &v, Property *desc, PropertyAttributes *attrs)
static ReturnedValue method_valueOf(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_get_proto(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_getOwnPropertySymbols(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_isSealed(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_isExtensible(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_keys(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
void init(ExecutionEngine *engine, Object *ctor)
static ReturnedValue method_values(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_preventExtensions(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue fromPropertyDescriptor(ExecutionEngine *engine, const Property *desc, PropertyAttributes attrs)
static Heap::ArrayObject * getOwnPropertyNames(ExecutionEngine *v4, const Value &o)
static ReturnedValue method_assign(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_isFrozen(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_defineSetter(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_defineGetter(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_is(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_toString(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_setPrototypeOf(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_isPrototypeOf(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_freeze(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
void defineDefaultProperty(StringOrSymbol *name, const Value &value, PropertyAttributes attributes=Attr_Data|Attr_NotEnumerable)
void defineReadonlyConfigurableProperty(const QString &name, const Value &value)
void defineReadonlyProperty(const QString &name, const Value &value)
void push_back(const Value &v)
ReturnedValue get(StringOrSymbol *name, bool *hasProperty=nullptr, const Value *receiver=nullptr) const
static PropertyKey fromArrayIndex(uint idx)
Value * alloc(qint64 nValues) const =delete
bool hasException() const
QML_NEARLY_ALWAYS_INLINE ReturnedValue asReturnedValue() const
constexpr ReturnedValue asReturnedValue() const
static constexpr VTable::CallAsConstructor virtualCallAsConstructor
static constexpr VTable::Call virtualCall
static constexpr Value fromInt32(int i)
Heap::String * toString(ExecutionEngine *e) const
static constexpr Value fromBoolean(bool b)
static constexpr Value undefinedValue()
static constexpr Value fromReturnedValue(ReturnedValue val)
static constexpr Value emptyValue()
Heap::Object * toObject(ExecutionEngine *e) const