diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-09-18 17:01:59 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-09-23 17:27:43 +0000 |
commit | a97d118bf55e1c44ded9bbcd143b0f0725db8268 (patch) | |
tree | e0f22b61ba294199758eaf25c7e4f3c71bae7470 /src/qml/jsruntime/qv4runtime.cpp | |
parent | 3440b8f9c5b198be4124ee1defd69d807bb972c6 (diff) |
Better inheritance structure for functions
Give Arrow functions their own representation. This also prepares
for further optimizations especially for the instanceof operator.
Change-Id: I1f70c0271169a237e1acdeb7fe855be957ba2ea5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 8f529cea76..0a098ff7ef 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -987,8 +987,8 @@ static Object *getSuperBase(Scope &scope) } ScopedFunctionObject f(scope, scope.engine->currentStackFrame->jsFrame->function); - MemberFunction *m = f->as<MemberFunction>(); - if (!m) { + ScopedObject homeObject(scope, f->getHomeObject()); + if (!homeObject) { ScopedContext ctx(scope, static_cast<ExecutionContext *>(&scope.engine->currentStackFrame->jsFrame->context)); Q_ASSERT(ctx); while (ctx) { @@ -1000,13 +1000,12 @@ static Object *getSuperBase(Scope &scope) } ctx = ctx->d()->outer; } - m = f->as<MemberFunction>(); + homeObject = f->getHomeObject(); } - if (!m) { + if (!homeObject) { scope.engine->throwTypeError(); return nullptr; } - ScopedObject homeObject(scope, m->d()->homeObject); Q_ASSERT(homeObject); ScopedObject proto(scope, homeObject->getPrototypeOf()); if (!proto) { |