diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-03-20 21:46:29 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-04-26 21:37:42 +0000 |
commit | 09cd6f8020b7c25eaaf959a48c452b01aebcf627 (patch) | |
tree | 69749d463a95d123aabcfea807a0a689bc8fcd2f /src/qml/compiler/qv4codegen.cpp | |
parent | cfac31cd823bd8eb83900adeecbfd3d789a3ee1d (diff) | |
download | qtdeclarative-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.cpp | 20 |
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; |