diff options
author | Lars Knoll <lars.knoll@digia.com> | 2012-12-13 12:09:04 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-12-13 12:38:11 +0100 |
commit | 9edd6967753c16512c8c589f3dedcae02687070a (patch) | |
tree | a8c4460d5c556fa9b087c229ba88dd68980ce9ef /qv4ir_p.h | |
parent | d6fcbdbf5182dcd549ef685cfeb2e3e90d3e81c7 (diff) |
Correctly set up nested functions
Make sure we have the correct set of nested functions in
both IR::Function and VM::Function. This is required so
that closures can work correctly.
Change-Id: I42493d5ee503090653b71650c8d19e06c4bcfdda
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'qv4ir_p.h')
-rw-r--r-- | qv4ir_p.h | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -587,9 +587,11 @@ struct Ret: Stmt { struct Module { MemoryPool pool; QVector<Function *> functions; + Function *rootFunction; - Function *newFunction(const QString &name); + Function *newFunction(const QString &name, Function *outer); + Module() : rootFunction(0) {} ~Module(); }; @@ -603,11 +605,11 @@ struct Function { QSet<QString> strings; QList<const QString *> formals; QList<const QString *> locals; + QVector<Function *> nestedFunctions; int insideWith; bool hasDirectEval: 1; - bool hasNestedFunctions: 1; bool isStrict: 1; template <typename _Tp> _Tp *New() { return new (pool->allocate(sizeof(_Tp))) _Tp(); } @@ -619,7 +621,6 @@ struct Function { , maxNumberOfArguments(0) , insideWith(0) , hasDirectEval(false) - , hasNestedFunctions(false) , isStrict(false) { this->name = newString(name); } |