2012-10-12 08:12:24 +00:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
|
|
|
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
|
|
|
** Contact: http://www.qt-project.org/legal
|
|
|
|
**
|
|
|
|
** This file is part of the V4VM module of the Qt Toolkit.
|
|
|
|
**
|
|
|
|
** $QT_BEGIN_LICENSE:LGPL$
|
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
**
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 3.0 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU General Public License version 3.0 requirements will be
|
|
|
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
|
|
|
**
|
|
|
|
**
|
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
2012-04-16 19:23:25 +00:00
|
|
|
|
|
|
|
#include "qmljs_objects.h"
|
2012-05-07 14:05:05 +00:00
|
|
|
#include "qv4ir_p.h"
|
2012-05-14 15:12:25 +00:00
|
|
|
#include "qv4ecmaobjects_p.h"
|
2012-05-18 08:10:36 +00:00
|
|
|
#include <QtCore/qmath.h>
|
2012-05-07 14:05:05 +00:00
|
|
|
#include <QtCore/QDebug>
|
2012-04-16 19:23:25 +00:00
|
|
|
#include <cassert>
|
2012-05-25 15:45:15 +00:00
|
|
|
#include <typeinfo>
|
2012-04-16 19:23:25 +00:00
|
|
|
|
2012-05-04 13:28:04 +00:00
|
|
|
using namespace QQmlJS::VM;
|
|
|
|
|
2012-05-18 08:10:36 +00:00
|
|
|
//
|
|
|
|
// Object
|
|
|
|
//
|
2012-05-04 13:12:37 +00:00
|
|
|
Object::~Object()
|
|
|
|
{
|
|
|
|
delete members;
|
|
|
|
}
|
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
void Object::__put__(Context *ctx, const QString &name, const Value &value)
|
2012-05-14 14:03:10 +00:00
|
|
|
{
|
2012-10-29 14:37:02 +00:00
|
|
|
__put__(ctx, ctx->engine->identifier(name), value);
|
2012-05-14 14:03:10 +00:00
|
|
|
}
|
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
void Object::__put__(Context *ctx, const QString &name, void (*code)(Context *), int count)
|
2012-05-14 14:03:10 +00:00
|
|
|
{
|
2012-05-14 15:38:53 +00:00
|
|
|
Q_UNUSED(count);
|
2012-10-29 14:37:02 +00:00
|
|
|
__put__(ctx, name, Value::fromObject(ctx->engine->newNativeFunction(ctx, code)));
|
2012-05-28 18:17:13 +00:00
|
|
|
}
|
|
|
|
|
2012-11-10 22:35:06 +00:00
|
|
|
Value Object::getValue(Context *ctx, PropertyDescriptor *p) const
|
|
|
|
{
|
|
|
|
if (p->isData())
|
|
|
|
return p->value;
|
|
|
|
if (!p->get)
|
|
|
|
return Value::undefinedValue();
|
|
|
|
|
|
|
|
p->get->call(ctx, Value::fromObject(const_cast<Object *>(this)), 0, 0);
|
|
|
|
return ctx->result;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Object::inplaceBinOp(Value rhs, Context *ctx, String *name, BinOp op)
|
|
|
|
{
|
|
|
|
PropertyDescriptor to_fill;
|
|
|
|
PropertyDescriptor *pd = __getPropertyDescriptor__(ctx, name, &to_fill);
|
|
|
|
if (!pd)
|
|
|
|
return false;
|
|
|
|
Value result = op(getValue(ctx, pd), rhs, ctx);
|
|
|
|
__put__(ctx, name, result);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-11-11 20:56:38 +00:00
|
|
|
bool Object::inplaceBinOp(Value rhs, Value index, BinOp op, Context *ctx)
|
|
|
|
{
|
|
|
|
String *name = index.toString(ctx);
|
|
|
|
assert(name);
|
|
|
|
return inplaceBinOp(rhs, ctx, name, op);
|
|
|
|
}
|
|
|
|
|
2012-10-28 20:56:15 +00:00
|
|
|
// Section 8.12.1
|
2012-10-29 14:37:02 +00:00
|
|
|
PropertyDescriptor *Object::__getOwnProperty__(Context *, String *name)
|
2012-04-16 19:23:25 +00:00
|
|
|
{
|
2012-10-28 20:56:15 +00:00
|
|
|
if (members)
|
|
|
|
return members->find(name);
|
2012-04-16 19:23:25 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
// Section 8.12.2
|
|
|
|
PropertyDescriptor *Object::__getPropertyDescriptor__(Context *ctx, String *name, PropertyDescriptor *to_fill)
|
2012-04-16 19:23:25 +00:00
|
|
|
{
|
2012-10-29 14:37:02 +00:00
|
|
|
if (PropertyDescriptor *p = __getOwnProperty__(ctx, name))
|
2012-10-28 20:56:15 +00:00
|
|
|
return p;
|
|
|
|
|
|
|
|
if (prototype)
|
2012-10-29 14:37:02 +00:00
|
|
|
return prototype->__getPropertyDescriptor__(ctx, name, to_fill);
|
2012-04-16 19:23:25 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
// Section 8.12.3
|
|
|
|
Value Object::__get__(Context *ctx, String *name)
|
2012-04-16 19:23:25 +00:00
|
|
|
{
|
2012-10-29 14:37:02 +00:00
|
|
|
if (name->isEqualTo(ctx->engine->id___proto__))
|
|
|
|
return Value::fromObject(prototype);
|
2012-04-16 19:23:25 +00:00
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
PropertyDescriptor tmp;
|
2012-11-10 22:35:06 +00:00
|
|
|
if (PropertyDescriptor *p = __getPropertyDescriptor__(ctx, name, &tmp))
|
|
|
|
return getValue(ctx, p);
|
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
return Value::undefinedValue();
|
2012-04-16 19:23:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-28 20:56:15 +00:00
|
|
|
// Section 8.12.4
|
2012-10-29 14:37:02 +00:00
|
|
|
bool Object::__canPut__(Context *ctx, String *name)
|
2012-04-16 19:23:25 +00:00
|
|
|
{
|
2012-10-29 14:37:02 +00:00
|
|
|
if (PropertyDescriptor *p = __getOwnProperty__(ctx, name)) {
|
2012-10-28 20:56:15 +00:00
|
|
|
if (p->isAccessor())
|
|
|
|
return p->get != 0;
|
|
|
|
return p->isWritable();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! prototype)
|
2012-04-16 19:23:25 +00:00
|
|
|
return extensible;
|
2012-10-28 20:56:15 +00:00
|
|
|
|
|
|
|
PropertyDescriptor tmp;
|
2012-10-29 14:37:02 +00:00
|
|
|
if (PropertyDescriptor *p = prototype->__getPropertyDescriptor__(ctx, name, &tmp)) {
|
2012-10-28 20:56:15 +00:00
|
|
|
if (p->isAccessor())
|
|
|
|
return p->get != 0;
|
|
|
|
if (!extensible)
|
|
|
|
return false;
|
|
|
|
return p->isWritable();
|
2012-04-16 19:23:25 +00:00
|
|
|
} else {
|
|
|
|
return extensible;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
// Section 8.12.5
|
|
|
|
void Object::__put__(Context *ctx, String *name, const Value &value, bool throwException)
|
2012-04-16 19:23:25 +00:00
|
|
|
{
|
2012-10-29 14:37:02 +00:00
|
|
|
// clause 1
|
|
|
|
if (!__canPut__(ctx, name))
|
|
|
|
goto reject;
|
2012-04-16 19:23:25 +00:00
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
if (!members)
|
|
|
|
members = new PropertyTable();
|
|
|
|
|
|
|
|
{
|
|
|
|
// Clause 2
|
|
|
|
PropertyDescriptor *pd = __getOwnProperty__(ctx, name);
|
|
|
|
// Clause 3
|
|
|
|
if (pd && pd->isData()) {
|
|
|
|
// spec says to call [[DefineOwnProperty]] with { [[Value]]: value }
|
|
|
|
|
|
|
|
// ### to simplify and speed up we should expand the relevant parts here (clauses 6,7,9,10,12,13)
|
|
|
|
PropertyDescriptor desc = PropertyDescriptor::fromValue(value);
|
|
|
|
__defineOwnProperty__(ctx, name, &desc, throwException);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// clause 4
|
|
|
|
PropertyDescriptor tmp;
|
|
|
|
if (prototype)
|
|
|
|
pd = prototype->__getPropertyDescriptor__(ctx, name, &tmp);
|
|
|
|
|
|
|
|
// Clause 5
|
|
|
|
if (pd && pd->isAccessor()) {
|
|
|
|
assert(pd->set != 0);
|
|
|
|
|
|
|
|
Value args[1];
|
|
|
|
args[0] = value;
|
2012-11-10 11:45:00 +00:00
|
|
|
pd->set->call(ctx, Value::fromObject(this), args, 1);
|
2012-10-29 14:37:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
PropertyDescriptor *p = members->insert(name);
|
|
|
|
*p = PropertyDescriptor::fromValue(value);
|
2012-10-29 14:50:07 +00:00
|
|
|
p->configurable = PropertyDescriptor::Set;
|
|
|
|
p->enumberable = PropertyDescriptor::Set;
|
|
|
|
p->writable = PropertyDescriptor::Set;
|
2012-10-29 14:37:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
reject:
|
|
|
|
if (throwException)
|
|
|
|
__qmljs_throw_type_error(ctx);
|
2012-04-16 19:23:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
// Section 8.12.6
|
|
|
|
bool Object::__hasProperty__(Context *ctx, String *name) const
|
2012-04-16 19:23:25 +00:00
|
|
|
{
|
|
|
|
if (members)
|
2012-10-29 14:37:02 +00:00
|
|
|
return members->find(name) != 0;
|
2012-04-16 19:23:25 +00:00
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
return prototype ? prototype->__hasProperty__(ctx, name) : false;
|
2012-04-16 19:23:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
// Section 8.12.7
|
|
|
|
bool Object::__delete__(Context *ctx, String *name, bool throwException)
|
|
|
|
{
|
|
|
|
if (members) {
|
|
|
|
if (PropertyTableEntry *entry = members->findEntry(name)) {
|
|
|
|
if (entry->descriptor.isConfigurable()) {
|
|
|
|
members->remove(entry);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (throwException)
|
|
|
|
__qmljs_throw_type_error(ctx);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Section 8.12.9
|
|
|
|
bool Object::__defineOwnProperty__(Context *ctx, String *name, PropertyDescriptor *desc, bool throwException)
|
2012-05-20 17:59:47 +00:00
|
|
|
{
|
2012-10-28 20:56:15 +00:00
|
|
|
if (!members)
|
|
|
|
members = new PropertyTable();
|
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
// Clause 1
|
|
|
|
PropertyDescriptor *current = __getOwnProperty__(ctx, name);
|
|
|
|
if (!current) {
|
|
|
|
// clause 3
|
2012-10-28 20:56:15 +00:00
|
|
|
if (!extensible)
|
|
|
|
goto reject;
|
2012-10-29 14:37:02 +00:00
|
|
|
// clause 4
|
|
|
|
*current = *desc;
|
|
|
|
current->fullyPopulated();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// clause 5
|
|
|
|
if (desc->isEmpty())
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// clause 6
|
|
|
|
if (desc->isSubset(current))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// clause 7
|
|
|
|
if (!current->isConfigurable()) {
|
|
|
|
if (desc->isConfigurable())
|
|
|
|
goto reject;
|
|
|
|
if (desc->enumberable != PropertyDescriptor::Unset && desc->enumberable != current->enumberable)
|
|
|
|
goto reject;
|
2012-10-28 20:56:15 +00:00
|
|
|
}
|
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
// clause 8
|
|
|
|
if (desc->isGeneric())
|
|
|
|
goto accept;
|
|
|
|
|
|
|
|
// clause 9
|
|
|
|
if (current->isData() != desc->isData()) {
|
|
|
|
// 9a
|
|
|
|
if (!current->isConfigurable())
|
|
|
|
goto reject;
|
|
|
|
if (current->isData()) {
|
|
|
|
// 9b
|
|
|
|
current->type = PropertyDescriptor::Accessor;
|
|
|
|
current->writable = PropertyDescriptor::Undefined;
|
|
|
|
current->get = 0;
|
|
|
|
current->set = 0;
|
|
|
|
} else {
|
|
|
|
// 9c
|
|
|
|
current->type = PropertyDescriptor::Data;
|
|
|
|
current->writable = PropertyDescriptor::Unset;
|
|
|
|
current->value = Value::undefinedValue();
|
|
|
|
}
|
|
|
|
} else if (current->isData() && desc->isData()) { // clause 10
|
|
|
|
if (!current->isConfigurable() && !current->isWritable()) {
|
|
|
|
if (desc->isWritable() || !current->value.sameValue(desc->value))
|
|
|
|
goto reject;
|
|
|
|
}
|
|
|
|
} else { // clause 10
|
|
|
|
assert(current->isAccessor() && desc->isAccessor());
|
|
|
|
if (!current->isConfigurable()) {
|
|
|
|
if (current->get != desc->get || current->set != desc->set)
|
|
|
|
goto reject;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
accept:
|
|
|
|
|
|
|
|
*current += *desc;
|
|
|
|
return true;
|
2012-10-28 20:56:15 +00:00
|
|
|
reject:
|
2012-10-29 14:37:02 +00:00
|
|
|
if (throwException)
|
2012-10-28 20:56:15 +00:00
|
|
|
__qmljs_throw_type_error(ctx);
|
|
|
|
return false;
|
2012-05-25 10:54:36 +00:00
|
|
|
}
|
2012-05-20 17:59:47 +00:00
|
|
|
|
2012-10-28 15:24:06 +00:00
|
|
|
String *ForEachIteratorObject::nextPropertyName()
|
|
|
|
{
|
2012-10-28 20:56:15 +00:00
|
|
|
PropertyTableEntry *p = 0;
|
2012-10-28 15:24:06 +00:00
|
|
|
while (1) {
|
|
|
|
if (!current)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
// ### index array data as well
|
|
|
|
++tableIndex;
|
|
|
|
if (!current->members || tableIndex > current->members->_propertyCount) {
|
|
|
|
current = current->prototype;
|
|
|
|
tableIndex = -1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
p = current->members->_properties[tableIndex];
|
|
|
|
// ### check that it's not a repeated attribute
|
2012-10-29 14:50:07 +00:00
|
|
|
if (p && p->descriptor.isEnumerable())
|
2012-10-28 15:24:06 +00:00
|
|
|
return p->name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
Value ArrayObject::__get__(Context *ctx, String *name)
|
2012-05-25 10:54:36 +00:00
|
|
|
{
|
|
|
|
if (name->isEqualTo(ctx->engine->id_length))
|
2012-09-19 19:08:47 +00:00
|
|
|
return Value::fromDouble(value.size());
|
2012-10-29 14:37:02 +00:00
|
|
|
return Object::__get__(ctx, name);
|
2012-05-20 17:59:47 +00:00
|
|
|
}
|
|
|
|
|
2012-11-11 20:56:38 +00:00
|
|
|
bool ArrayObject::inplaceBinOp(Value rhs, Value index, BinOp op, Context *ctx)
|
|
|
|
{
|
|
|
|
if (index.isNumber()) {
|
|
|
|
const quint32 idx = index.toUInt32(ctx);
|
|
|
|
Value v = value.at(idx);
|
|
|
|
v = op(v, rhs, ctx);
|
|
|
|
value.assign(idx, v);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return Object::inplaceBinOp(rhs, index, op, ctx);
|
|
|
|
}
|
|
|
|
|
2012-05-28 18:17:13 +00:00
|
|
|
bool FunctionObject::hasInstance(Context *ctx, const Value &value)
|
2012-04-16 19:23:25 +00:00
|
|
|
{
|
2012-05-28 18:17:13 +00:00
|
|
|
if (! value.isObject()) {
|
|
|
|
ctx->throwTypeError();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
Value o = __get__(ctx, ctx->engine->id_prototype);
|
2012-05-28 18:17:13 +00:00
|
|
|
if (! o.isObject()) {
|
|
|
|
ctx->throwTypeError();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-09-19 19:08:47 +00:00
|
|
|
Object *v = value.objectValue();
|
2012-05-28 18:17:13 +00:00
|
|
|
while (v) {
|
|
|
|
v = v->prototype;
|
|
|
|
|
|
|
|
if (! v)
|
|
|
|
break;
|
2012-09-19 19:08:47 +00:00
|
|
|
else if (o.objectValue() == v)
|
2012-05-28 18:17:13 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-04-16 19:23:25 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-11-10 11:45:00 +00:00
|
|
|
Value FunctionObject::construct(Context *context, Value *args, int argc)
|
|
|
|
{
|
|
|
|
Context k;
|
|
|
|
Context *ctx = needsActivation ? context->engine->newContext() : &k;
|
|
|
|
ctx->initConstructorContext(context, 0, this, args, argc);
|
|
|
|
construct(ctx);
|
|
|
|
ctx->leaveConstructorContext(this);
|
|
|
|
return ctx->result;
|
|
|
|
}
|
|
|
|
|
|
|
|
Value FunctionObject::call(Context *context, Value thisObject, Value *args, int argc)
|
|
|
|
{
|
|
|
|
Context k;
|
|
|
|
Context *ctx = needsActivation ? context->engine->newContext() : &k;
|
|
|
|
const Value *that = thisObject.isUndefined() ? 0 : &thisObject;
|
|
|
|
ctx->initCallContext(context, that, this, args, argc);
|
|
|
|
call(ctx);
|
|
|
|
ctx->leaveCallContext();
|
|
|
|
return ctx->result;
|
|
|
|
}
|
|
|
|
|
2012-05-07 14:05:05 +00:00
|
|
|
void FunctionObject::call(Context *ctx)
|
2012-04-16 19:23:25 +00:00
|
|
|
{
|
2012-05-07 14:05:05 +00:00
|
|
|
Q_UNUSED(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
void FunctionObject::construct(Context *ctx)
|
|
|
|
{
|
2012-10-18 06:52:40 +00:00
|
|
|
ctx->thisObject = Value::fromObject(ctx->engine->newObject());
|
2012-05-09 11:30:22 +00:00
|
|
|
call(ctx);
|
2012-05-07 14:05:05 +00:00
|
|
|
}
|
2012-04-16 19:23:25 +00:00
|
|
|
|
2012-05-13 11:50:55 +00:00
|
|
|
ScriptFunction::ScriptFunction(Context *scope, IR::Function *function)
|
|
|
|
: FunctionObject(scope)
|
2012-05-09 13:47:55 +00:00
|
|
|
, function(function)
|
2012-05-07 14:05:05 +00:00
|
|
|
{
|
2012-06-11 07:38:52 +00:00
|
|
|
if (function->name)
|
|
|
|
name = scope->engine->identifier(*function->name);
|
2012-05-15 08:02:21 +00:00
|
|
|
needsActivation = function->needsActivation();
|
2012-05-08 09:13:02 +00:00
|
|
|
formalParameterCount = function->formals.size();
|
|
|
|
if (formalParameterCount) {
|
|
|
|
formalParameterList = new String*[formalParameterCount];
|
2012-06-05 08:47:04 +00:00
|
|
|
for (unsigned int i = 0; i < formalParameterCount; ++i) {
|
2012-05-14 15:12:25 +00:00
|
|
|
formalParameterList[i] = scope->engine->identifier(*function->formals.at(i));
|
2012-05-08 09:13:02 +00:00
|
|
|
}
|
2012-05-07 14:05:05 +00:00
|
|
|
}
|
2012-05-16 09:58:07 +00:00
|
|
|
|
|
|
|
varCount = function->locals.size();
|
|
|
|
if (varCount) {
|
|
|
|
varList = new String*[varCount];
|
2012-06-05 08:47:04 +00:00
|
|
|
for (unsigned int i = 0; i < varCount; ++i) {
|
2012-05-16 09:58:07 +00:00
|
|
|
varList[i] = scope->engine->identifier(*function->locals.at(i));
|
|
|
|
}
|
|
|
|
}
|
2012-05-08 09:13:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ScriptFunction::~ScriptFunction()
|
|
|
|
{
|
|
|
|
delete[] formalParameterList;
|
2012-05-16 09:58:07 +00:00
|
|
|
delete[] varList;
|
2012-05-08 09:13:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScriptFunction::call(VM::Context *ctx)
|
|
|
|
{
|
2012-06-12 17:13:55 +00:00
|
|
|
function->code(ctx, function->codeData);
|
2012-04-16 19:23:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
Value RegExpObject::__get__(Context *ctx, String *name)
|
2012-10-19 21:10:42 +00:00
|
|
|
{
|
|
|
|
QString n = name->toQString();
|
|
|
|
if (n == QLatin1String("source"))
|
|
|
|
return Value::fromString(ctx, value.pattern());
|
|
|
|
else if (n == QLatin1String("global"))
|
|
|
|
return Value::fromBoolean(global);
|
|
|
|
else if (n == QLatin1String("ignoreCase"))
|
|
|
|
return Value::fromBoolean(value.patternOptions() & QRegularExpression::CaseInsensitiveOption);
|
|
|
|
else if (n == QLatin1String("multiline"))
|
|
|
|
return Value::fromBoolean(value.patternOptions() & QRegularExpression::MultilineOption);
|
|
|
|
else if (n == QLatin1String("lastIndex"))
|
|
|
|
return lastIndex;
|
2012-10-29 14:37:02 +00:00
|
|
|
return Object::__get__(ctx, name);
|
2012-10-19 21:10:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-10 10:14:20 +00:00
|
|
|
void ScriptFunction::construct(VM::Context *ctx)
|
|
|
|
{
|
2012-05-28 19:49:20 +00:00
|
|
|
Object *obj = ctx->engine->newObject();
|
2012-10-29 14:37:02 +00:00
|
|
|
Value proto = __get__(ctx, ctx->engine->id_prototype);
|
2012-05-28 19:49:20 +00:00
|
|
|
if (proto.isObject())
|
2012-09-19 19:08:47 +00:00
|
|
|
obj->prototype = proto.objectValue();
|
2012-10-18 06:52:40 +00:00
|
|
|
ctx->thisObject = Value::fromObject(obj);
|
2012-06-12 17:13:55 +00:00
|
|
|
function->code(ctx, function->codeData);
|
2012-05-10 10:14:20 +00:00
|
|
|
}
|
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
PropertyDescriptor *ActivationObject::__getPropertyDescriptor__(Context *ctx, String *name, PropertyDescriptor *to_fill)
|
2012-04-16 19:23:25 +00:00
|
|
|
{
|
2012-05-08 09:13:02 +00:00
|
|
|
if (context) {
|
2012-06-05 08:47:04 +00:00
|
|
|
for (unsigned int i = 0; i < context->varCount; ++i) {
|
2012-05-16 09:58:07 +00:00
|
|
|
String *var = context->vars[i];
|
2012-10-29 11:26:40 +00:00
|
|
|
if (__qmljs_string_equal(var, name)) {
|
2012-10-28 20:56:15 +00:00
|
|
|
*to_fill = PropertyDescriptor::fromValue(context->locals[i]);
|
|
|
|
to_fill->writable = PropertyDescriptor::Set;
|
2012-10-29 14:50:07 +00:00
|
|
|
to_fill->enumberable = PropertyDescriptor::Set;
|
2012-10-28 20:56:15 +00:00
|
|
|
return to_fill;
|
2012-05-16 09:58:07 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-05 08:47:04 +00:00
|
|
|
for (unsigned int i = 0; i < context->formalCount; ++i) {
|
2012-05-08 09:13:02 +00:00
|
|
|
String *formal = context->formals[i];
|
2012-10-29 11:26:40 +00:00
|
|
|
if (__qmljs_string_equal(formal, name)) {
|
2012-10-28 20:56:15 +00:00
|
|
|
*to_fill = PropertyDescriptor::fromValue(context->arguments[i]);
|
|
|
|
to_fill->writable = PropertyDescriptor::Set;
|
2012-10-29 14:50:07 +00:00
|
|
|
to_fill->enumberable = PropertyDescriptor::Set;
|
2012-10-28 20:56:15 +00:00
|
|
|
return to_fill;
|
2012-05-08 09:13:02 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-04 14:36:00 +00:00
|
|
|
if (name->isEqualTo(ctx->engine->id_arguments)) {
|
|
|
|
if (arguments.isUndefined()) {
|
|
|
|
arguments = Value::fromObject(new ArgumentsObject(ctx));
|
2012-09-19 19:08:47 +00:00
|
|
|
arguments.objectValue()->prototype = ctx->engine->objectPrototype;
|
2012-06-04 14:36:00 +00:00
|
|
|
}
|
|
|
|
|
2012-10-28 20:56:15 +00:00
|
|
|
*to_fill = PropertyDescriptor::fromValue(arguments);
|
2012-10-29 14:50:07 +00:00
|
|
|
to_fill->writable = PropertyDescriptor::Unset;
|
|
|
|
to_fill->enumberable = PropertyDescriptor::Unset;
|
2012-10-28 20:56:15 +00:00
|
|
|
return to_fill;
|
2012-06-04 14:36:00 +00:00
|
|
|
}
|
2012-05-08 09:13:02 +00:00
|
|
|
}
|
2012-10-28 20:56:15 +00:00
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
return Object::__getPropertyDescriptor__(ctx, name, to_fill);
|
2012-04-16 19:23:25 +00:00
|
|
|
}
|
2012-05-14 15:12:25 +00:00
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
Value ArgumentsObject::__get__(Context *ctx, String *name)
|
2012-06-04 14:36:00 +00:00
|
|
|
{
|
|
|
|
if (name->isEqualTo(ctx->engine->id_length))
|
2012-09-19 19:08:47 +00:00
|
|
|
return Value::fromDouble(context->argumentCount);
|
2012-10-29 14:37:02 +00:00
|
|
|
return Object::__get__(ctx, name);
|
2012-06-04 14:36:00 +00:00
|
|
|
}
|
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
PropertyDescriptor *ArgumentsObject::__getPropertyDescriptor__(Context *ctx, String *name, PropertyDescriptor *to_fill)
|
2012-06-04 14:36:00 +00:00
|
|
|
{
|
|
|
|
if (context) {
|
|
|
|
const quint32 i = Value::fromString(name).toUInt32(ctx);
|
2012-10-28 20:56:15 +00:00
|
|
|
if (i < context->argumentCount) {
|
|
|
|
*to_fill = PropertyDescriptor::fromValue(context->arguments[i]);
|
2012-10-29 14:50:07 +00:00
|
|
|
to_fill->writable = PropertyDescriptor::Unset;
|
|
|
|
to_fill->enumberable = PropertyDescriptor::Unset;
|
2012-10-28 20:56:15 +00:00
|
|
|
return to_fill;
|
|
|
|
}
|
2012-06-04 14:36:00 +00:00
|
|
|
}
|
2012-10-28 20:56:15 +00:00
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
return Object::__getPropertyDescriptor__(ctx, name, to_fill);
|
2012-06-04 14:36:00 +00:00
|
|
|
}
|
|
|
|
|
2012-05-14 15:12:25 +00:00
|
|
|
ExecutionEngine::ExecutionEngine()
|
|
|
|
{
|
2012-05-15 08:35:19 +00:00
|
|
|
rootContext = newContext();
|
2012-05-14 15:12:25 +00:00
|
|
|
rootContext->init(this);
|
|
|
|
|
2012-05-25 10:54:36 +00:00
|
|
|
id_length = identifier(QStringLiteral("length"));
|
|
|
|
id_prototype = identifier(QStringLiteral("prototype"));
|
2012-05-28 19:49:20 +00:00
|
|
|
id_constructor = identifier(QStringLiteral("constructor"));
|
2012-06-04 14:36:00 +00:00
|
|
|
id_arguments = identifier(QStringLiteral("arguments"));
|
2012-05-28 18:17:13 +00:00
|
|
|
id___proto__ = identifier(QStringLiteral("__proto__"));
|
2012-05-25 10:54:36 +00:00
|
|
|
|
2012-05-25 15:45:15 +00:00
|
|
|
objectPrototype = new ObjectPrototype();
|
|
|
|
stringPrototype = new StringPrototype(rootContext);
|
|
|
|
numberPrototype = new NumberPrototype();
|
|
|
|
booleanPrototype = new BooleanPrototype();
|
|
|
|
arrayPrototype = new ArrayPrototype();
|
|
|
|
datePrototype = new DatePrototype();
|
|
|
|
functionPrototype = new FunctionPrototype(rootContext);
|
2012-06-04 13:34:50 +00:00
|
|
|
regExpPrototype = new RegExpPrototype();
|
2012-11-01 14:37:47 +00:00
|
|
|
errorPrototype = new ErrorPrototype();
|
2012-05-25 15:45:15 +00:00
|
|
|
|
|
|
|
stringPrototype->prototype = objectPrototype;
|
|
|
|
numberPrototype->prototype = objectPrototype;
|
|
|
|
booleanPrototype->prototype = objectPrototype;
|
|
|
|
arrayPrototype->prototype = objectPrototype;
|
|
|
|
datePrototype->prototype = objectPrototype;
|
|
|
|
functionPrototype->prototype = objectPrototype;
|
2012-06-04 13:34:50 +00:00
|
|
|
regExpPrototype->prototype = objectPrototype;
|
2012-11-01 14:37:47 +00:00
|
|
|
errorPrototype->prototype = objectPrototype;
|
2012-06-04 13:34:50 +00:00
|
|
|
|
|
|
|
objectCtor = Value::fromObject(new ObjectCtor(rootContext));
|
|
|
|
stringCtor = Value::fromObject(new StringCtor(rootContext));
|
|
|
|
numberCtor = Value::fromObject(new NumberCtor(rootContext));
|
|
|
|
booleanCtor = Value::fromObject(new BooleanCtor(rootContext));
|
|
|
|
arrayCtor = Value::fromObject(new ArrayCtor(rootContext));
|
|
|
|
functionCtor = Value::fromObject(new FunctionCtor(rootContext));
|
|
|
|
dateCtor = Value::fromObject(new DateCtor(rootContext));
|
|
|
|
regExpCtor = Value::fromObject(new RegExpCtor(rootContext));
|
2012-11-01 14:37:47 +00:00
|
|
|
errorCtor = Value::fromObject(new ErrorCtor(rootContext));
|
2012-06-04 13:34:50 +00:00
|
|
|
|
2012-09-19 19:08:47 +00:00
|
|
|
stringCtor.objectValue()->prototype = functionPrototype;
|
|
|
|
numberCtor.objectValue()->prototype = functionPrototype;
|
|
|
|
booleanCtor.objectValue()->prototype = functionPrototype;
|
|
|
|
arrayCtor.objectValue()->prototype = functionPrototype;
|
|
|
|
functionCtor.objectValue()->prototype = functionPrototype;
|
|
|
|
dateCtor.objectValue()->prototype = functionPrototype;
|
|
|
|
regExpCtor.objectValue()->prototype = functionPrototype;
|
2012-11-01 14:37:47 +00:00
|
|
|
errorCtor.objectValue()->prototype = functionPrototype;
|
2012-05-25 15:45:15 +00:00
|
|
|
|
|
|
|
objectPrototype->init(rootContext, objectCtor);
|
|
|
|
stringPrototype->init(rootContext, stringCtor);
|
|
|
|
numberPrototype->init(rootContext, numberCtor);
|
|
|
|
booleanPrototype->init(rootContext, booleanCtor);
|
|
|
|
arrayPrototype->init(rootContext, arrayCtor);
|
|
|
|
datePrototype->init(rootContext, dateCtor);
|
|
|
|
functionPrototype->init(rootContext, functionCtor);
|
2012-06-04 13:34:50 +00:00
|
|
|
regExpPrototype->init(rootContext, regExpCtor);
|
2012-11-01 14:37:47 +00:00
|
|
|
errorPrototype->init(rootContext, errorCtor);
|
2012-05-25 15:45:15 +00:00
|
|
|
|
2012-05-14 15:12:25 +00:00
|
|
|
//
|
|
|
|
// set up the global object
|
|
|
|
//
|
2012-06-26 13:17:31 +00:00
|
|
|
VM::Object *glo = newObject(/*rootContext*/);
|
2012-10-18 06:52:40 +00:00
|
|
|
globalObject = Value::fromObject(glo);
|
|
|
|
rootContext->activation = Value::fromObject(glo);
|
2012-05-14 15:12:25 +00:00
|
|
|
|
2012-10-29 14:37:02 +00:00
|
|
|
glo->__put__(rootContext, identifier(QStringLiteral("Object")), objectCtor);
|
|
|
|
glo->__put__(rootContext, identifier(QStringLiteral("String")), stringCtor);
|
|
|
|
glo->__put__(rootContext, identifier(QStringLiteral("Number")), numberCtor);
|
|
|
|
glo->__put__(rootContext, identifier(QStringLiteral("Boolean")), booleanCtor);
|
|
|
|
glo->__put__(rootContext, identifier(QStringLiteral("Array")), arrayCtor);
|
|
|
|
glo->__put__(rootContext, identifier(QStringLiteral("Function")), functionCtor);
|
|
|
|
glo->__put__(rootContext, identifier(QStringLiteral("Date")), dateCtor);
|
|
|
|
glo->__put__(rootContext, identifier(QStringLiteral("RegExp")), regExpCtor);
|
2012-11-01 14:37:47 +00:00
|
|
|
glo->__put__(rootContext, identifier(QStringLiteral("Error")), errorCtor);
|
2012-10-29 14:37:02 +00:00
|
|
|
glo->__put__(rootContext, identifier(QStringLiteral("Math")), Value::fromObject(newMathObject(rootContext)));
|
2012-10-30 06:45:58 +00:00
|
|
|
glo->__put__(rootContext, identifier(QStringLiteral("undefined")), Value::undefinedValue());
|
|
|
|
glo->__put__(rootContext, identifier(QStringLiteral("NaN")), Value::fromDouble(nan("")));
|
|
|
|
glo->__put__(rootContext, identifier(QStringLiteral("Infinity")), Value::fromDouble(INFINITY));
|
2012-05-15 08:35:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Context *ExecutionEngine::newContext()
|
|
|
|
{
|
|
|
|
return new Context();
|
2012-05-14 15:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
String *ExecutionEngine::identifier(const QString &s)
|
|
|
|
{
|
|
|
|
String *&id = identifiers[s];
|
|
|
|
if (! id)
|
2012-05-15 08:35:19 +00:00
|
|
|
id = newString(s);
|
2012-05-14 15:12:25 +00:00
|
|
|
return id;
|
|
|
|
}
|
2012-05-15 08:35:19 +00:00
|
|
|
|
|
|
|
FunctionObject *ExecutionEngine::newNativeFunction(Context *scope, void (*code)(Context *))
|
|
|
|
{
|
2012-05-21 13:16:19 +00:00
|
|
|
NativeFunction *f = new NativeFunction(scope, code);
|
2012-05-25 15:45:15 +00:00
|
|
|
f->prototype = scope->engine->functionPrototype;
|
2012-05-21 13:16:19 +00:00
|
|
|
return f;
|
2012-05-15 08:35:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FunctionObject *ExecutionEngine::newScriptFunction(Context *scope, IR::Function *function)
|
|
|
|
{
|
2012-05-21 13:16:19 +00:00
|
|
|
ScriptFunction *f = new ScriptFunction(scope, function);
|
2012-05-28 19:49:20 +00:00
|
|
|
Object *proto = scope->engine->newObject();
|
2012-10-29 14:37:02 +00:00
|
|
|
proto->__put__(scope, scope->engine->id_constructor, Value::fromObject(f));
|
|
|
|
f->__put__(scope, scope->engine->id_prototype, Value::fromObject(proto));
|
2012-05-25 15:45:15 +00:00
|
|
|
f->prototype = scope->engine->functionPrototype;
|
2012-05-21 13:16:19 +00:00
|
|
|
return f;
|
2012-05-15 08:35:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Object *ExecutionEngine::newObject()
|
|
|
|
{
|
2012-05-21 08:09:41 +00:00
|
|
|
Object *object = new Object();
|
2012-05-25 15:45:15 +00:00
|
|
|
object->prototype = objectPrototype;
|
2012-05-21 08:09:41 +00:00
|
|
|
return object;
|
2012-05-15 08:35:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FunctionObject *ExecutionEngine::newObjectCtor(Context *ctx)
|
|
|
|
{
|
|
|
|
return new ObjectCtor(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
String *ExecutionEngine::newString(const QString &s)
|
|
|
|
{
|
|
|
|
return new String(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
Object *ExecutionEngine::newStringObject(const Value &value)
|
|
|
|
{
|
2012-05-21 08:09:41 +00:00
|
|
|
StringObject *object = new StringObject(value);
|
2012-05-25 15:45:15 +00:00
|
|
|
object->prototype = stringPrototype;
|
2012-05-21 08:09:41 +00:00
|
|
|
return object;
|
2012-05-15 08:35:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FunctionObject *ExecutionEngine::newStringCtor(Context *ctx)
|
|
|
|
{
|
|
|
|
return new StringCtor(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
Object *ExecutionEngine::newNumberObject(const Value &value)
|
|
|
|
{
|
2012-05-21 08:09:41 +00:00
|
|
|
NumberObject *object = new NumberObject(value);
|
2012-05-25 15:45:15 +00:00
|
|
|
object->prototype = numberPrototype;
|
2012-05-21 08:09:41 +00:00
|
|
|
return object;
|
2012-05-15 08:35:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FunctionObject *ExecutionEngine::newNumberCtor(Context *ctx)
|
|
|
|
{
|
|
|
|
return new NumberCtor(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
Object *ExecutionEngine::newBooleanObject(const Value &value)
|
|
|
|
{
|
2012-05-21 08:09:41 +00:00
|
|
|
Object *object = new BooleanObject(value);
|
2012-05-25 15:45:15 +00:00
|
|
|
object->prototype = booleanPrototype;
|
2012-05-21 08:09:41 +00:00
|
|
|
return object;
|
2012-05-15 08:35:19 +00:00
|
|
|
}
|
|
|
|
|
2012-05-15 09:19:10 +00:00
|
|
|
FunctionObject *ExecutionEngine::newBooleanCtor(Context *ctx)
|
|
|
|
{
|
|
|
|
return new BooleanCtor(ctx);
|
|
|
|
}
|
|
|
|
|
2012-05-21 12:57:02 +00:00
|
|
|
Object *ExecutionEngine::newFunctionObject(Context *ctx)
|
|
|
|
{
|
|
|
|
Object *object = new FunctionObject(ctx);
|
2012-05-25 15:45:15 +00:00
|
|
|
object->prototype = functionPrototype;
|
2012-05-21 12:57:02 +00:00
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
FunctionObject *ExecutionEngine::newFunctionCtor(Context *ctx)
|
|
|
|
{
|
|
|
|
return new FunctionCtor(ctx);
|
|
|
|
}
|
|
|
|
|
2012-05-20 17:59:47 +00:00
|
|
|
Object *ExecutionEngine::newArrayObject()
|
|
|
|
{
|
|
|
|
ArrayObject *object = new ArrayObject();
|
2012-05-25 15:45:15 +00:00
|
|
|
object->prototype = arrayPrototype;
|
2012-05-20 17:59:47 +00:00
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
Object *ExecutionEngine::newArrayObject(const Array &value)
|
|
|
|
{
|
|
|
|
ArrayObject *object = new ArrayObject(value);
|
2012-05-25 15:45:15 +00:00
|
|
|
object->prototype = arrayPrototype;
|
2012-05-20 17:59:47 +00:00
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
FunctionObject *ExecutionEngine::newArrayCtor(Context *ctx)
|
|
|
|
{
|
|
|
|
return new ArrayCtor(ctx);
|
|
|
|
}
|
|
|
|
|
2012-05-18 08:10:36 +00:00
|
|
|
Object *ExecutionEngine::newDateObject(const Value &value)
|
|
|
|
{
|
2012-05-21 08:09:41 +00:00
|
|
|
Object *object = new DateObject(value);
|
2012-05-25 15:45:15 +00:00
|
|
|
object->prototype = datePrototype;
|
2012-05-21 08:09:41 +00:00
|
|
|
return object;
|
2012-05-18 08:10:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FunctionObject *ExecutionEngine::newDateCtor(Context *ctx)
|
|
|
|
{
|
|
|
|
return new DateCtor(ctx);
|
|
|
|
}
|
|
|
|
|
2012-10-19 21:10:42 +00:00
|
|
|
Object *ExecutionEngine::newRegExpObject(const QString &pattern, int flags)
|
2012-06-04 13:34:50 +00:00
|
|
|
{
|
2012-10-19 21:10:42 +00:00
|
|
|
bool global = (flags & IR::RegExp::RegExp_Global);
|
|
|
|
QRegularExpression::PatternOptions options = 0;
|
|
|
|
if (flags & IR::RegExp::RegExp_IgnoreCase)
|
|
|
|
options |= QRegularExpression::CaseInsensitiveOption;
|
|
|
|
if (flags & IR::RegExp::RegExp_Multiline)
|
|
|
|
options |= QRegularExpression::MultilineOption;
|
|
|
|
|
|
|
|
Object *object = new RegExpObject(QRegularExpression(pattern, options), global);
|
2012-06-04 13:34:50 +00:00
|
|
|
object->prototype = regExpPrototype;
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
FunctionObject *ExecutionEngine::newRegExpCtor(Context *ctx)
|
|
|
|
{
|
|
|
|
return new RegExpCtor(ctx);
|
|
|
|
}
|
|
|
|
|
2012-05-15 08:35:19 +00:00
|
|
|
Object *ExecutionEngine::newErrorObject(const Value &value)
|
|
|
|
{
|
2012-05-25 09:55:50 +00:00
|
|
|
ErrorObject *object = new ErrorObject(value);
|
2012-05-25 15:45:15 +00:00
|
|
|
object->prototype = objectPrototype;
|
2012-05-25 09:55:50 +00:00
|
|
|
return object;
|
2012-05-15 08:35:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Object *ExecutionEngine::newMathObject(Context *ctx)
|
|
|
|
{
|
2012-05-25 09:55:50 +00:00
|
|
|
MathObject *object = new MathObject(ctx);
|
2012-05-25 15:45:15 +00:00
|
|
|
object->prototype = objectPrototype;
|
2012-05-25 09:55:50 +00:00
|
|
|
return object;
|
2012-05-15 08:35:19 +00:00
|
|
|
}
|
|
|
|
|
2012-06-04 14:36:00 +00:00
|
|
|
Object *ExecutionEngine::newActivationObject(Context *ctx)
|
2012-05-15 08:35:19 +00:00
|
|
|
{
|
2012-06-04 14:36:00 +00:00
|
|
|
return new ActivationObject(ctx);
|
2012-05-15 08:35:19 +00:00
|
|
|
}
|
2012-10-28 15:24:06 +00:00
|
|
|
|
|
|
|
Object *ExecutionEngine::newForEachIteratorObject(Object *o)
|
|
|
|
{
|
|
|
|
return new ForEachIteratorObject(o);
|
|
|
|
}
|