diff options
author | Lars Knoll <[email protected]> | 2018-07-31 15:27:59 +0200 |
---|---|---|
committer | Simon Hausmann <[email protected]> | 2018-08-01 13:18:02 +0000 |
commit | 81c5febf86339c141fb75bb2c3d166ac00b26f19 (patch) | |
tree | ddb45633d88f7cf6fa7ec5684943c965cc7ff30d /src/qml/jsruntime/qv4functionobject.cpp | |
parent | 1ec824ed2f6b18705ecc4d9565f97ade5319da52 (diff) |
Fix naming of methods defined in object or class literals
Change-Id: I01b7774097a447520c85ae6766e6ca1162e921ba
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 8722ff65b6..b0f9f5198e 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -101,7 +101,7 @@ void Heap::FunctionObject::init(QV4::ExecutionContext *scope, QV4::String *name, -void Heap::FunctionObject::init(QV4::ExecutionContext *scope, Function *function, bool createProto) +void Heap::FunctionObject::init(QV4::ExecutionContext *scope, Function *function, QV4::String *n) { jsCall = vtable()->call; jsConstruct = vtable()->callAsConstructor; @@ -110,13 +110,10 @@ void Heap::FunctionObject::init(QV4::ExecutionContext *scope, Function *function setFunction(function); this->scope.set(scope->engine(), scope->d()); Scope s(scope->engine()); - ScopedString name(s, function->name()); + ScopedString name(s, n ? n->d() : function->name()); ScopedFunctionObject f(s, this); if (name) f->setName(name); - - if (createProto) - f->createDefaultPrototypeProperty(Heap::FunctionObject::Index_Prototype, Heap::FunctionObject::Index_ProtoConstructor); } void Heap::FunctionObject::init(QV4::ExecutionContext *scope, const QString &name, bool createProto) @@ -195,9 +192,9 @@ Heap::FunctionObject *FunctionObject::createConstructorFunction(ExecutionContext return c; } -Heap::FunctionObject *FunctionObject::createMemberFunction(ExecutionContext *scope, Function *function) +Heap::FunctionObject *FunctionObject::createMemberFunction(ExecutionContext *scope, Function *function, QV4::String *name) { - return scope->engine()->memoryManager->allocate<MemberFunction>(scope, function); + return scope->engine()->memoryManager->allocate<MemberFunction>(scope, function, name); } Heap::FunctionObject *FunctionObject::createBuiltinFunction(ExecutionEngine *engine, StringOrSymbol *nameOrSymbol, VTable::Call code, int argumentCount) @@ -515,7 +512,7 @@ ReturnedValue ScriptFunction::virtualCall(const FunctionObject *fo, const Value return result; } -void Heap::ScriptFunction::init(QV4::ExecutionContext *scope, Function *function) +void Heap::ScriptFunction::init(QV4::ExecutionContext *scope, Function *function, QV4::String *n) { FunctionObject::init(); this->scope.set(scope->engine(), scope->d()); @@ -526,7 +523,7 @@ void Heap::ScriptFunction::init(QV4::ExecutionContext *scope, Function *function Scope s(scope); ScopedFunctionObject f(s, this); - ScopedString name(s, function->name()); + ScopedString name(s, n ? n->d() : function->name()); if (name) f->setName(name); f->createDefaultPrototypeProperty(Heap::FunctionObject::Index_Prototype, Heap::FunctionObject::Index_ProtoConstructor); |