summaryrefslogtreecommitdiff
path: root/src/qml/compiler/qv4compilerscanfunctions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/compiler/qv4compilerscanfunctions.cpp')
-rw-r--r--src/qml/compiler/qv4compilerscanfunctions.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp
index eda0102844..8b8c385b84 100644
--- a/src/qml/compiler/qv4compilerscanfunctions.cpp
+++ b/src/qml/compiler/qv4compilerscanfunctions.cpp
@@ -226,6 +226,21 @@ bool ScanFunctions::visit(FunctionExpression *ast)
bool ScanFunctions::visit(ClassExpression *ast)
{
+ enterEnvironment(ast, ContextType::Block, QStringLiteral("%Class"));
+ _context->isStrict = true;
+ _context->hasNestedFunctions = true;
+ if (!ast->name.isEmpty())
+ _context->addLocalVar(ast->name.toString(), Context::VariableDeclaration, AST::VariableScope::Let);
+ return true;
+}
+
+void ScanFunctions::endVisit(ClassExpression *)
+{
+ leaveEnvironment();
+}
+
+bool ScanFunctions::visit(ClassDeclaration *ast)
+{
if (!ast->name.isEmpty())
_context->addLocalVar(ast->name.toString(), Context::VariableDeclaration, AST::VariableScope::Let);
@@ -237,7 +252,7 @@ bool ScanFunctions::visit(ClassExpression *ast)
return true;
}
-void ScanFunctions::endVisit(ClassExpression *)
+void ScanFunctions::endVisit(ClassDeclaration *)
{
leaveEnvironment();
}