diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-03-16 19:58:06 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-04-26 21:37:27 +0000 |
commit | a62101f2df57997158f69c2483323287fb018d26 (patch) | |
tree | 592f730de855b6f7c236da34bd5e23de9874015f /src/qml/parser/qqmljsast_p.h | |
parent | 67ce06f2c0642fa0a9a4eb4f2239cb99a62d2040 (diff) |
Add partial support for computed property names
Computed property names currently work in object literals
and destructuring arguments.
Change-Id: I9dc5bc61b45139ef1836072695ea2fe1ce4994ae
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/parser/qqmljsast_p.h')
-rw-r--r-- | src/qml/parser/qqmljsast_p.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h index 30f6011924..60a3fdf589 100644 --- a/src/qml/parser/qqmljsast_p.h +++ b/src/qml/parser/qqmljsast_p.h @@ -158,6 +158,7 @@ public: Kind_FunctionExpression, Kind_IdentifierExpression, Kind_IdentifierPropertyName, + Kind_ComputedPropertyName, Kind_IfStatement, Kind_LabelledStatement, Kind_LocalForEachStatement, @@ -752,7 +753,7 @@ public: SourceLocation rbraceToken; }; -class QML_PARSER_EXPORT IdentifierPropertyName: public PropertyName +class QML_PARSER_EXPORT IdentifierPropertyName : public PropertyName { public: QQMLJS_DECLARE_AST_NODE(IdentifierPropertyName) @@ -800,6 +801,30 @@ public: double id; }; +class QML_PARSER_EXPORT ComputedPropertyName : public PropertyName +{ +public: + QQMLJS_DECLARE_AST_NODE(ComputedPropertyName) + + ComputedPropertyName(ExpressionNode *expression) + : expression(expression) + { kind = K; } + + void accept0(Visitor *visitor) override; + + QString asString() const override { return QString(); } + + SourceLocation firstSourceLocation() const override + { return expression->firstSourceLocation(); } + + SourceLocation lastSourceLocation() const override + { return expression->lastSourceLocation(); } + +// attributes + ExpressionNode *expression; +}; + + class QML_PARSER_EXPORT ArrayMemberExpression: public ExpressionNode { public: |