aboutsummaryrefslogtreecommitdiffstats
path: root/qmljs_environment.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2012-11-25 00:26:28 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-25 10:21:12 +0100
commit15326415d127e17016b60820b85c85016c3682e6 (patch)
tree4bc0df4dee49d6649c164cca56b547598b8969f2 /qmljs_environment.cpp
parent87b31798170233b92f13ba4d39e0278fdf61e10e (diff)
Fix some issues with the delete operator
Properly implement delete operator for identifiers and local variables. Change-Id: I8ac55edc80c31a94d11444c9f5c78caf4b131c95 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'qmljs_environment.cpp')
-rw-r--r--qmljs_environment.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/qmljs_environment.cpp b/qmljs_environment.cpp
index 5504763b31..8093c120f2 100644
--- a/qmljs_environment.cpp
+++ b/qmljs_environment.cpp
@@ -221,6 +221,26 @@ PropertyDescriptor *ExecutionContext::lookupPropertyDescriptor(String *name, Pro
return 0;
}
+bool ExecutionContext::deleteProperty(String *name)
+{
+ for (DeclarativeEnvironment *ctx = lexicalEnvironment; ctx; ctx = ctx->outer) {
+ if (ctx->withObject) {
+ DeclarativeEnvironment::With *w = ctx->withObject;
+ while (w) {
+ if (w->object->__hasProperty__(this, name))
+ w->object->__delete__(this, name);
+ w = w->next;
+ }
+ }
+ if (ctx->activation) {
+ if (ctx->activation->__hasProperty__(this, name))
+ ctx->activation->__delete__(this, name);
+ }
+ }
+ // ### throw syntax error in strict mode
+ return true;
+}
+
void ExecutionContext::inplaceBitOp(Value value, String *name, BinOp op)
{
for (DeclarativeEnvironment *ctx = lexicalEnvironment; ctx; ctx = ctx->outer) {