aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <[email protected]>2014-05-08 15:32:31 +0200
committerSimon Hausmann <[email protected]>2014-07-22 13:49:14 +0200
commit76f3a874f42a5fc689334fa371f386762e37cc78 (patch)
tree62f2880ce6e2c6209e559bdf591385037a8c5eb2 /src/qml/jsruntime/qv4functionobject.cpp
parent519471a77a67bb72f4d0995db70a95f290b13c6a (diff)
Convert delegate model and indexed builtin function
Change-Id: Ic7d50aa472d6a1bafadb6641f88b5f89a9b893ad Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp44
1 files changed, 41 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 7fef9f700e..791ff0f3b3 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -74,6 +74,44 @@ using namespace QV4;
DEFINE_OBJECT_VTABLE(FunctionObject);
+FunctionObject::Data::Data(ExecutionContext *scope, String *name, bool createProto)
+ : Object::Data(scope->d()->engine->functionClass)
+ , scope(scope)
+{
+ Scope s(scope);
+ ScopedFunctionObject f(s, this);
+ f->init(name, createProto);
+}
+
+
+FunctionObject::Data::Data(ExecutionContext *scope, const QString &name, bool createProto)
+ : Object::Data(scope->d()->engine->functionClass)
+ , scope(scope)
+{
+ Scope s(scope);
+ ScopedFunctionObject f(s, this);
+ ScopedString n(s, s.engine->newString(name));
+ f->init(n.getPointer(), createProto);
+}
+
+FunctionObject::Data::Data(ExecutionContext *scope, const ReturnedValue name)
+ : Object::Data(scope->d()->engine->functionClass)
+ , scope(scope)
+{
+ Scope s(scope);
+ ScopedFunctionObject f(s, this);
+ ScopedString n(s, name);
+ f->init(n.getPointer(), false);
+}
+
+FunctionObject::Data::Data(InternalClass *ic)
+ : Object::Data(ic)
+ , scope(ic->engine->rootContext)
+{
+ memberData.ensureIndex(ic->engine, Index_Prototype);
+ memberData[Index_Prototype] = Encode::undefined();
+}
+
FunctionObject::FunctionObject(ExecutionContext *scope, String *name, bool createProto)
: Object(scope->d()->engine->functionClass)
{
@@ -117,10 +155,10 @@ FunctionObject::FunctionObject(InternalClass *ic)
memberData()[Index_Prototype] = Encode::undefined();
}
-FunctionObject::~FunctionObject()
+FunctionObject::Data::~Data()
{
- if (function())
- function()->compilationUnit->deref();
+ if (function)
+ function->compilationUnit->deref();
}
void FunctionObject::init(String *n, bool createProto)