diff options
Diffstat (limited to 'src/qml/qml/parser/qqmljsast_p.h')
-rw-r--r-- | src/qml/qml/parser/qqmljsast_p.h | 115 |
1 files changed, 90 insertions, 25 deletions
diff --git a/src/qml/qml/parser/qqmljsast_p.h b/src/qml/qml/parser/qqmljsast_p.h index 65a598c783..01a872f1e8 100644 --- a/src/qml/qml/parser/qqmljsast_p.h +++ b/src/qml/qml/parser/qqmljsast_p.h @@ -57,7 +57,7 @@ #include "qqmljsglobal_p.h" #include "qqmljsmemorypool_p.h" -#include <QtCore/QString> +#include <QtCore/qstring.h> QT_QML_BEGIN_NAMESPACE @@ -176,8 +176,10 @@ public: Kind_PreDecrementExpression, Kind_PreIncrementExpression, Kind_Program, + Kind_PropertyAssignmentList, + Kind_PropertyGetterSetter, Kind_PropertyName, - Kind_PropertyNameAndValueList, + Kind_PropertyNameAndValue, Kind_RegExpLiteral, Kind_ReturnStatement, Kind_SourceElement, @@ -487,7 +489,7 @@ public: ObjectLiteral(): properties (0) { kind = K; } - ObjectLiteral(PropertyNameAndValueList *plist): + ObjectLiteral(PropertyAssignmentList *plist): properties (plist) { kind = K; } virtual void accept0(Visitor *visitor); @@ -499,7 +501,7 @@ public: { return rbraceToken; } // attributes - PropertyNameAndValueList *properties; + PropertyAssignmentList *properties; SourceLocation lbraceToken; SourceLocation rbraceToken; }; @@ -603,50 +605,113 @@ public: SourceLocation propertyNameToken; }; -class QML_PARSER_EXPORT PropertyNameAndValueList: public Node +class QML_PARSER_EXPORT PropertyAssignment: public Node { public: - QQMLJS_DECLARE_AST_NODE(PropertyNameAndValueList) + PropertyAssignment() {} +}; - PropertyNameAndValueList(PropertyName *n, ExpressionNode *v): - name (n), value (v), next (this) - { kind = K; } +class QML_PARSER_EXPORT PropertyAssignmentList: public Node +{ +public: + QQMLJS_DECLARE_AST_NODE(PropertyAssignmentList) - PropertyNameAndValueList(PropertyNameAndValueList *previous, PropertyName *n, ExpressionNode *v): - name (n), value (v) + PropertyAssignmentList(PropertyAssignment *assignment) + : assignment(assignment) + , next(this) + { kind = K; } + + PropertyAssignmentList(PropertyAssignmentList *previous, PropertyAssignment *assignment) + : assignment(assignment) { kind = K; next = previous->next; previous->next = this; } + inline PropertyAssignmentList *finish () + { + PropertyAssignmentList *front = next; + next = 0; + return front; + } + virtual void accept0(Visitor *visitor); virtual SourceLocation firstSourceLocation() const - { return name->firstSourceLocation(); } + { return assignment->firstSourceLocation(); } virtual SourceLocation lastSourceLocation() const - { - if (next) - return next->lastSourceLocation(); - return value->lastSourceLocation(); - } + { return next ? next->lastSourceLocation() : assignment->lastSourceLocation(); } - inline PropertyNameAndValueList *finish () - { - PropertyNameAndValueList *front = next; - next = 0; - return front; - } +// attributes + PropertyAssignment *assignment; + PropertyAssignmentList *next; + SourceLocation commaToken; +}; + +class QML_PARSER_EXPORT PropertyNameAndValue: public PropertyAssignment +{ +public: + QQMLJS_DECLARE_AST_NODE(PropertyNameAndValue) + + PropertyNameAndValue(PropertyName *n, ExpressionNode *v) + : name(n), value(v) + { kind = K; } + + virtual void accept0(Visitor *visitor); + + virtual SourceLocation firstSourceLocation() const + { return name->firstSourceLocation(); } + + virtual SourceLocation lastSourceLocation() const + { return value->lastSourceLocation(); } // attributes PropertyName *name; - ExpressionNode *value; - PropertyNameAndValueList *next; SourceLocation colonToken; + ExpressionNode *value; SourceLocation commaToken; }; +class QML_PARSER_EXPORT PropertyGetterSetter: public PropertyAssignment +{ +public: + QQMLJS_DECLARE_AST_NODE(PropertyGetterSetter) + + enum Type { + Getter, + Setter + }; + + PropertyGetterSetter(PropertyName *n, FunctionBody *b) + : type(Getter), name(n), formals(0), functionBody (b) + { kind = K; } + + PropertyGetterSetter(PropertyName *n, FormalParameterList *f, FunctionBody *b) + : type(Setter), name(n), formals(f), functionBody (b) + { kind = K; } + + virtual void accept0(Visitor *visitor); + + virtual SourceLocation firstSourceLocation() const + { return getSetToken; } + + virtual SourceLocation lastSourceLocation() const + { return rbraceToken; } + +// attributes + Type type; + SourceLocation getSetToken; + PropertyName *name; + SourceLocation lparenToken; + FormalParameterList *formals; + SourceLocation rparenToken; + SourceLocation lbraceToken; + FunctionBody *functionBody; + SourceLocation rbraceToken; +}; + class QML_PARSER_EXPORT IdentifierPropertyName: public PropertyName { public: |