diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-03-22 16:34:05 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-04-27 08:11:28 +0000 |
commit | 02252ae08dc36ba44f65fb932c428849c7369299 (patch) | |
tree | 5c7627b08cce5bfa2df5e04b3427bcc93ef2b2fe /src/qml/parser/qqmljsastvisitor_p.h | |
parent | e07a03365ad07cd4294f487b15a57f31bd0a3d40 (diff) |
Rework the AST for Literals and destructuring expressions
Array/ObjectLiterals and destructuring expressions are
syntactically very similar. In some cases (when using
a destructuring expression as the lhs of an assigment),
the parser needs to convert the literal into a destructuring
expression.
To support these, use the same data structures for both in
the AST. Those Patterns can be converted with little
additional work from a Literal to an AssignmentPattern and
be used in all places where we need destructuring in addition
to literals.
Change-Id: I177599b46eab0f6e8cb2a40c3b3b11ed00a07d6a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/parser/qqmljsastvisitor_p.h')
-rw-r--r-- | src/qml/parser/qqmljsastvisitor_p.h | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/src/qml/parser/qqmljsastvisitor_p.h b/src/qml/parser/qqmljsastvisitor_p.h index a8534ca684..184fcecd1c 100644 --- a/src/qml/parser/qqmljsastvisitor_p.h +++ b/src/qml/parser/qqmljsastvisitor_p.h @@ -143,20 +143,20 @@ public: virtual bool visit(ObjectPattern *) { return true; } virtual void endVisit(ObjectPattern *) {} - virtual bool visit(ElementList *) { return true; } - virtual void endVisit(ElementList *) {} + virtual bool visit(PatternElementList *) { return true; } + virtual void endVisit(PatternElementList *) {} - virtual bool visit(Elision *) { return true; } - virtual void endVisit(Elision *) {} + virtual bool visit(PatternPropertyList *) { return true; } + virtual void endVisit(PatternPropertyList *) {} - virtual bool visit(PropertyDefinitionList *) { return true; } - virtual void endVisit(PropertyDefinitionList *) {} + virtual bool visit(PatternElement *) { return true; } + virtual void endVisit(PatternElement *) {} - virtual bool visit(PropertyNameAndValue *) { return true; } - virtual void endVisit(PropertyNameAndValue *) {} + virtual bool visit(PatternProperty *) { return true; } + virtual void endVisit(PatternProperty *) {} - virtual bool visit(PropertyGetterSetter *) { return true; } - virtual void endVisit(PropertyGetterSetter *) {} + virtual bool visit(Elision *) { return true; } + virtual void endVisit(Elision *) {} virtual bool visit(NestedExpression *) { return true; } virtual void endVisit(NestedExpression *) {} @@ -329,24 +329,6 @@ public: virtual bool visit(FunctionExpression *) { return true; } virtual void endVisit(FunctionExpression *) {} - virtual bool visit(ObjectBindingPattern *) { return true; } - virtual void endVisit(ObjectBindingPattern *) {} - - virtual bool visit(ArrayBindingPattern *) { return true; } - virtual void endVisit(ArrayBindingPattern *) {} - - virtual bool visit(BindingElement *) { return true; } - virtual void endVisit(BindingElement *) {} - - virtual bool visit(BindingElementList *) { return true; } - virtual void endVisit(BindingElementList *) {} - - virtual bool visit(BindingPropertyList *) { return true; } - virtual void endVisit(BindingPropertyList *) {} - - virtual bool visit(BindingRestElement *) { return true; } - virtual void endVisit(BindingRestElement *) {} - virtual bool visit(FormalParameterList *) { return true; } virtual void endVisit(FormalParameterList *) {} |