From 4cf7e80c5740912804383e4d866ba12b2520d0e6 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 4 May 2018 15:16:08 +0200 Subject: Ensure we have a lexical scope for global code This requires a bit more work than simply pushing a new BlockContext for the lexically declared variables, as eval() and the Function constructor operate on the global scope (including the lexically declared names). To fix this introduce Push/PopScriptContext instructions, that create a BlockContext for the lexically declared vars and pushes that one as a global script context that eval and friends use. Change-Id: I0fd0b0f682f82e250545e874fe93978449fe5e46 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4generatorobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qml/jsruntime/qv4generatorobject.cpp') diff --git a/src/qml/jsruntime/qv4generatorobject.cpp b/src/qml/jsruntime/qv4generatorobject.cpp index 4339a95f45..c91e182b54 100644 --- a/src/qml/jsruntime/qv4generatorobject.cpp +++ b/src/qml/jsruntime/qv4generatorobject.cpp @@ -63,7 +63,7 @@ ReturnedValue GeneratorFunctionCtor::callAsConstructor(const FunctionObject *f, return Encode::undefined(); Function *vmf = compilationUnit->linkToEngine(engine); - ExecutionContext *global = engine->rootContext(); + ExecutionContext *global = engine->scriptContext(); return Encode(GeneratorFunction::create(global, vmf)); } -- cgit v1.2.3