aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser/qqmljsast_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-02-26 10:08:37 +0100
committerLars Knoll <lars.knoll@qt.io>2018-04-25 17:49:44 +0000
commitaabf2196016d96bd171a7d632b6e1cc5622d05ae (patch)
tree6e30bcc5bb6b6fbaa30d31b296e254ad0048e5a3 /src/qml/parser/qqmljsast_p.h
parentda5fffbd34d8be68f8ee4c649881dbb673c9c0a5 (diff)
Support for destructuring arrays
add support for destructuring of arrays when passing arguments to functions. Change-Id: I19feb39aa3ae520ec7591d49d1b14ceaa78783c6 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.h32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h
index 6142b00712..52f6aeb1a2 100644
--- a/src/qml/parser/qqmljsast_p.h
+++ b/src/qml/parser/qqmljsast_p.h
@@ -2128,20 +2128,44 @@ class QML_PARSER_EXPORT BindingElementList : public Node
public:
QQMLJS_DECLARE_AST_NODE(BindingElementList)
- BindingElementList()
+ BindingElementList(Elision *e, Node *p)
+ : elision(e), param(p), next(this)
{ kind = K; }
+ BindingElementList *append(BindingElementList *n) {
+ n->next = next;
+ next = n;
+ return n;
+ }
+
+ inline BindingElementList *finish ()
+ {
+ BindingElementList *front = next;
+ next = 0;
+ return front;
+ }
+
+ BindingRestElement *bindingRestElement() const {
+ return cast<BindingRestElement *>(param);
+ }
+
+ BindingElement *bindingElement() const {
+ return cast<BindingElement *>(param);
+ }
+
void accept0(Visitor *visitor) override;
void boundNames(QStringList *names);
SourceLocation firstSourceLocation() const override
- { return loc; }
+ { return elision ? elision->firstSourceLocation() : param->firstSourceLocation(); }
SourceLocation lastSourceLocation() const override
- { return loc; }
+ { return next ? next->lastSourceLocation() : param->lastSourceLocation(); }
- SourceLocation loc;
+ Elision *elision = nullptr;
+ Node *param = nullptr;
+ BindingElementList *next;
};
class QML_PARSER_EXPORT BindingPropertyList : public Node