diff options
author | Lars Knoll <lars.knoll@digia.com> | 2012-11-16 22:21:34 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-18 13:21:21 +0100 |
commit | d6553a206bf3c263159764ab222cb7f43ed1da10 (patch) | |
tree | 8c86d7b909fe4ddad357a974976ead6be66daa86 /qmljs_objects.h | |
parent | 84f722c4963346cebe471eb44e762cf085ff8177 (diff) |
Create a proper function object for eval
Still doesn't work correctly, as we can't modify
the global context there.
Change-Id: Ifd0ab217c3cf2d0c1b86f09907b440ea31c29ac8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'qmljs_objects.h')
-rw-r--r-- | qmljs_objects.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/qmljs_objects.h b/qmljs_objects.h index 490eae2eef..3e06440b68 100644 --- a/qmljs_objects.h +++ b/qmljs_objects.h @@ -43,6 +43,7 @@ #include "qmljs_runtime.h" #include "qv4array_p.h" +#include "qv4codegen_p.h" #include <QtCore/QString> #include <QtCore/QHash> @@ -494,7 +495,7 @@ struct FunctionObject: Object { virtual bool hasInstance(Context *ctx, const Value &value); Value construct(Context *context, Value *args, int argc); - Value call(Context *context, Value thisObject, Value *args, int argc, bool strictMode = false); + virtual Value call(Context *context, Value thisObject, Value *args, int argc, bool strictMode = false); protected: virtual void call(Context *ctx); @@ -519,6 +520,17 @@ struct ScriptFunction: FunctionObject { virtual void construct(Context *ctx); }; +struct EvalFunction : FunctionObject +{ + EvalFunction(Context *scope): FunctionObject(scope) {} + + static int evaluate(QQmlJS::VM::Context *ctx, const QString &fileName, + const QString &source, bool useInterpreter, + QQmlJS::Codegen::Mode mode); + + virtual Value call(Context *context, Value thisObject, Value *args, int argc, bool strictMode = false); +}; + struct RegExpObject: Object { QRegularExpression value; Value lastIndex; |