diff options
author | Robin Burchell <robin.burchell@crimson.no> | 2017-01-28 13:48:06 +0100 |
---|---|---|
committer | Robin Burchell <robin.burchell@crimson.no> | 2017-02-02 15:49:13 +0000 |
commit | b63393c7aac7c337672b87a914cb059f60091584 (patch) | |
tree | 4a76fa63adf744945f047f6394498a54c8186dc8 /src/qml/parser | |
parent | 00b237a65825f26970eb8a14a5faa6af5a943e87 (diff) |
Codegen: Disallow const declaration without an initializer expression
This seems to match up with the spec behavior. 13.3.1.1 (Static Semantics:
Early Errors) says:
It is a Syntax Error if Initializer is not present and IsConstantDeclaration
of the LexicalDeclaration containing this production is true.
In addition, we also allow "const" to be used in JS mode too. We don't
yet fully support the semantics, but as it's there, why not let it work.
[ChangeLog][QtQml] "const" variable declarations are now available in JS
as well as QML mode.
[ChangeLog][QtQml] "const" variable declarations now require an
initializer, bringing them closer to the required spec behavior.
Task-number: QTBUG-58493
Change-Id: Ife5d5979b3e7a5d7340bf04f43605f847ee25ee2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/parser')
-rw-r--r-- | src/qml/parser/qqmljskeywords_p.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/parser/qqmljskeywords_p.h b/src/qml/parser/qqmljskeywords_p.h index 84ebe5f210..a31c188efc 100644 --- a/src/qml/parser/qqmljskeywords_p.h +++ b/src/qml/parser/qqmljskeywords_p.h @@ -278,7 +278,7 @@ static inline int classify5(const QChar *s, bool qmlMode) { if (s[2].unicode() == 'n') { if (s[3].unicode() == 's') { if (s[4].unicode() == 't') { - return qmlMode ? int(Lexer::T_CONST) : int(Lexer::T_RESERVED_WORD); + return int(Lexer::T_CONST); } } } |