summaryrefslogtreecommitdiff
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-03-20 21:46:29 +0100
committerLars Knoll <lars.knoll@qt.io>2018-04-26 21:37:42 +0000
commit09cd6f8020b7c25eaaf959a48c452b01aebcf627 (patch)
tree69749d463a95d123aabcfea807a0a689bc8fcd2f /src/qml/compiler/qv4codegen.cpp
parentcfac31cd823bd8eb83900adeecbfd3d789a3ee1d (diff)
downloadqtdeclarative-09cd6f8020b7c25eaaf959a48c452b01aebcf627.tar.gz
Add support for 'super' and 'new.target' to the AST
Codegen will still throw a Syntax error on it though. Change-Id: I292dd166ad8cb4a62f2bcfa9637bdc76cf95bb51 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 4b2a98bcad..29a916bd7e 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -1542,11 +1542,31 @@ bool Codegen::visit(FalseLiteral *)
return false;
}
+bool Codegen::visit(SuperLiteral *ast)
+{
+ if (hasError)
+ return false;
+
+ throwSyntaxError(ast->superToken, QLatin1String("Support for 'super' keyword not implemented"));
+ return false;
+}
+
bool Codegen::visit(FieldMemberExpression *ast)
{
if (hasError)
return false;
+ if (AST::IdentifierExpression *id = AST::cast<AST::IdentifierExpression *>(ast->base)) {
+ if (id->name == QLatin1String("new")) {
+ // new.target
+ if (ast->name != QLatin1String("target")) {
+ throwSyntaxError(ast->identifierToken, QLatin1String("Expected 'target' after 'new.'."));
+ return false;
+ }
+ throwSyntaxError(ast->identifierToken, QLatin1String("Support for 'new.target' unimplemented."));
+ }
+ }
+
Reference base = expression(ast->base);
if (hasError)
return false;