aboutsummaryrefslogtreecommitdiffstats
path: root/qmljs_objects.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2012-12-14 13:27:26 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-12-14 13:49:02 +0100
commite2b907a90e6aa87f70c83d5e24290f87980442ea (patch)
treec99880908f4d687fe47300eaf5075616514f84b9 /qmljs_objects.h
parente1c5e2f03b9c2bee49dfc64376de1b880ca530c0 (diff)
Fixes for arguments object in non strict mode
In non strict mode, the arguments object actually reflects the argument as it changes over the lifetime of a function, unless you explicitly delete some of it's properties. The code to implement this is pretty ugly, but still better then the specification :) Change-Id: Ie42ed25c797513615fbc4bdee14145d953f323f3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'qmljs_objects.h')
-rw-r--r--qmljs_objects.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/qmljs_objects.h b/qmljs_objects.h
index 21dc82a2cc..18b5271b3d 100644
--- a/qmljs_objects.h
+++ b/qmljs_objects.h
@@ -554,7 +554,7 @@ struct Function {
inline bool hasNestedFunctions() const { return !nestedFunctions.isEmpty(); }
- inline bool needsActivation() const { return hasNestedFunctions() || hasDirectEval; }
+ inline bool needsActivation() const { return hasNestedFunctions() || hasDirectEval || usesArgumentsObject; }
};
struct FunctionObject: Object {
@@ -710,9 +710,17 @@ struct URIErrorObject: ErrorObject {
};
struct ArgumentsObject: Object {
+ ExecutionContext *context;
+ int currentIndex;
ArgumentsObject(ExecutionContext *context);
virtual QString className() { return QStringLiteral("Arguments"); }
virtual ArgumentsObject *asArgumentsObject() { return this; }
+
+ virtual Value __get__(ExecutionContext *ctx, String *name, bool *hasProperty = 0);
+ virtual void __put__(ExecutionContext *ctx, String *name, Value value);
+
+ static Value method_getArg(ExecutionContext *ctx);
+ static Value method_setArg(ExecutionContext *ctx);
};
} // namespace VM