aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2015-10-27 12:21:00 +0100
committerErik Verbruggen <erik.verbruggen@theqtcompany.com>2015-10-27 13:17:33 +0000
commit9730574818c80b956946dc26458c839915855196 (patch)
tree2721a5a2b3e4fc19f85f25ff71c4bb7277f54da0 /src/qml/compiler
parent3832b1e05b80a0f509be17dd3619a2f8bb70074f (diff)
QML: Fix typeof context property.
This was missing from f21e8c641af6b2d10f0d7e7e0fc6a755dab3673c. Task-number: QTBUG-48524 Change-Id: I5cc6a979d965a1ef6b7fbc916a7ca9df868b459a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r--src/qml/compiler/qv4instr_moth_p.h16
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp19
-rw-r--r--src/qml/compiler/qv4isel_moth_p.h1
-rw-r--r--src/qml/compiler/qv4isel_p.cpp13
-rw-r--r--src/qml/compiler/qv4isel_p.h1
5 files changed, 48 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h
index 1eebcbbe7f..97aee80e91 100644
--- a/src/qml/compiler/qv4instr_moth_p.h
+++ b/src/qml/compiler/qv4instr_moth_p.h
@@ -102,6 +102,8 @@ QT_BEGIN_NAMESPACE
F(CallBuiltinDeleteMember, callBuiltinDeleteMember) \
F(CallBuiltinDeleteSubscript, callBuiltinDeleteSubscript) \
F(CallBuiltinDeleteName, callBuiltinDeleteName) \
+ F(CallBuiltinTypeofScopeObjectProperty, callBuiltinTypeofScopeObjectProperty) \
+ F(CallBuiltinTypeofContextObjectProperty, callBuiltinTypeofContextObjectProperty) \
F(CallBuiltinTypeofMember, callBuiltinTypeofMember) \
F(CallBuiltinTypeofSubscript, callBuiltinTypeofSubscript) \
F(CallBuiltinTypeofName, callBuiltinTypeofName) \
@@ -511,6 +513,18 @@ union Instr
int name;
Param result;
};
+ struct instr_callBuiltinTypeofScopeObjectProperty {
+ MOTH_INSTR_HEADER
+ int index;
+ Param base;
+ Param result;
+ };
+ struct instr_callBuiltinTypeofContextObjectProperty {
+ MOTH_INSTR_HEADER
+ int index;
+ Param base;
+ Param result;
+ };
struct instr_callBuiltinTypeofMember {
MOTH_INSTR_HEADER
int member;
@@ -809,6 +823,8 @@ union Instr
instr_callBuiltinDeleteMember callBuiltinDeleteMember;
instr_callBuiltinDeleteSubscript callBuiltinDeleteSubscript;
instr_callBuiltinDeleteName callBuiltinDeleteName;
+ instr_callBuiltinTypeofScopeObjectProperty callBuiltinTypeofScopeObjectProperty;
+ instr_callBuiltinTypeofContextObjectProperty callBuiltinTypeofContextObjectProperty;
instr_callBuiltinTypeofMember callBuiltinTypeofMember;
instr_callBuiltinTypeofSubscript callBuiltinTypeofSubscript;
instr_callBuiltinTypeofName callBuiltinTypeofName;
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index 0dae4d7696..afb36c5f14 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -1177,6 +1177,25 @@ void InstructionSelection::callBuiltinInvalid(IR::Name *func, IR::ExprList *args
addInstruction(call);
}
+void InstructionSelection::callBuiltinTypeofQmlContextProperty(IR::Expr *base, IR::Member::MemberKind kind, int propertyIndex, IR::Expr *result)
+{
+ if (kind == IR::Member::MemberOfQmlScopeObject) {
+ Instruction::CallBuiltinTypeofScopeObjectProperty call;
+ call.base = getParam(base);
+ call.index = propertyIndex;
+ call.result = getResultParam(result);
+ addInstruction(call);
+ } else if (kind == IR::Member::MemberOfQmlContextObject) {
+ Instruction::CallBuiltinTypeofContextObjectProperty call;
+ call.base = getParam(base);
+ call.index = propertyIndex;
+ call.result = getResultParam(result);
+ addInstruction(call);
+ } else {
+ Q_UNREACHABLE();
+ }
+}
+
void InstructionSelection::callBuiltinTypeofMember(IR::Expr *base, const QString &name,
IR::Expr *result)
{
diff --git a/src/qml/compiler/qv4isel_moth_p.h b/src/qml/compiler/qv4isel_moth_p.h
index 947461f98e..e2385aad6d 100644
--- a/src/qml/compiler/qv4isel_moth_p.h
+++ b/src/qml/compiler/qv4isel_moth_p.h
@@ -84,6 +84,7 @@ protected:
virtual void visitRet(IR::Ret *);
virtual void callBuiltinInvalid(IR::Name *func, IR::ExprList *args, IR::Expr *result);
+ virtual void callBuiltinTypeofQmlContextProperty(IR::Expr *base, IR::Member::MemberKind kind, int propertyIndex, IR::Expr *result);
virtual void callBuiltinTypeofMember(IR::Expr *base, const QString &name, IR::Expr *result);
virtual void callBuiltinTypeofSubscript(IR::Expr *base, IR::Expr *index, IR::Expr *result);
virtual void callBuiltinTypeofName(const QString &name, IR::Expr *result);
diff --git a/src/qml/compiler/qv4isel_p.cpp b/src/qml/compiler/qv4isel_p.cpp
index 9d172b1223..184cff43e6 100644
--- a/src/qml/compiler/qv4isel_p.cpp
+++ b/src/qml/compiler/qv4isel_p.cpp
@@ -282,8 +282,17 @@ void IRDecoder::callBuiltin(IR::Call *call, Expr *result)
return;
case IR::Name::builtin_typeof: {
- if (IR::Member *m = call->args->expr->asMember()) {
- callBuiltinTypeofMember(m->base, *m->name, result);
+ if (IR::Member *member = call->args->expr->asMember()) {
+#ifndef V4_BOOTSTRAP
+ Q_ASSERT(member->kind != IR::Member::MemberOfIdObjectsArray);
+ if (member->kind == IR::Member::MemberOfQmlScopeObject || member->kind == IR::Member::MemberOfQmlContextObject) {
+ callBuiltinTypeofQmlContextProperty(member->base,
+ IR::Member::MemberKind(member->kind),
+ member->property->coreIndex, result);
+ return;
+ }
+#endif
+ callBuiltinTypeofMember(member->base, *member->name, result);
return;
} else if (IR::Subscript *ss = call->args->expr->asSubscript()) {
callBuiltinTypeofSubscript(ss->base, ss->index, result);
diff --git a/src/qml/compiler/qv4isel_p.h b/src/qml/compiler/qv4isel_p.h
index 50ee955378..b78d323e7d 100644
--- a/src/qml/compiler/qv4isel_p.h
+++ b/src/qml/compiler/qv4isel_p.h
@@ -118,6 +118,7 @@ public: // visitor methods for StmtVisitor:
public: // to implement by subclasses:
virtual void callBuiltinInvalid(IR::Name *func, IR::ExprList *args, IR::Expr *result) = 0;
+ virtual void callBuiltinTypeofQmlContextProperty(IR::Expr *base, IR::Member::MemberKind kind, int propertyIndex, IR::Expr *result) = 0;
virtual void callBuiltinTypeofMember(IR::Expr *base, const QString &name, IR::Expr *result) = 0;
virtual void callBuiltinTypeofSubscript(IR::Expr *base, IR::Expr *index, IR::Expr *result) = 0;
virtual void callBuiltinTypeofName(const QString &name, IR::Expr *result) = 0;