aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/qml/compiler/qv4codegen.cpp2
-rw-r--r--src/qml/compiler/qv4codegen_p.h2
-rw-r--r--src/qml/parser/qqmljs.g3
-rw-r--r--src/qml/parser/qqmljsast.cpp4
-rw-r--r--src/qml/parser/qqmljsast_p.h6
-rw-r--r--src/qml/parser/qqmljsastfwd_p.h2
-rw-r--r--src/qml/parser/qqmljsastvisitor_p.h2
-rw-r--r--src/qmldom/qqmldomastcreator.cpp6
-rw-r--r--src/qmldom/qqmldomastcreator_p.h4
-rw-r--r--src/qmldom/qqmldomastdumper.cpp4
-rw-r--r--src/qmldom/qqmldomreformatter.cpp2
-rw-r--r--src/qmldom/qqmldomreformatter_p.h2
12 files changed, 20 insertions, 19 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 48807ad480..24672c367f 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -1144,7 +1144,7 @@ bool Codegen::visit(ClassDeclaration *ast)
return false;
}
-bool Codegen::visit(Expression *ast)
+bool Codegen::visit(CommaExpression *ast)
{
if (hasError())
return false;
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h
index 52ac2c546a..c65131ace3 100644
--- a/src/qml/compiler/qv4codegen_p.h
+++ b/src/qml/compiler/qv4codegen_p.h
@@ -623,12 +623,12 @@ protected:
bool visit(QQmlJS::AST::TypeAnnotation *ast) override;
// expressions
- bool visit(QQmlJS::AST::Expression *ast) override;
bool visit(QQmlJS::AST::ArrayPattern *ast) override;
bool visit(QQmlJS::AST::ArrayMemberExpression *ast) override;
bool visit(QQmlJS::AST::BinaryExpression *ast) override;
bool visit(QQmlJS::AST::CallExpression *ast) override;
void endVisit(QQmlJS::AST::CallExpression *ast) override;
+ bool visit(QQmlJS::AST::CommaExpression *ast) override;
bool visit(QQmlJS::AST::ConditionalExpression *ast) override;
bool visit(QQmlJS::AST::DeleteExpression *ast) override;
void endVisit(QQmlJS::AST::DeleteExpression *ast) override;
diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g
index a825c01092..9264a9502b 100644
--- a/src/qml/parser/qqmljs.g
+++ b/src/qml/parser/qqmljs.g
@@ -3092,7 +3092,8 @@ Expression: Expression T_COMMA AssignmentExpression;
Expression_In: Expression_In T_COMMA AssignmentExpression_In;
/.
case $rule_number: {
- AST::Expression *node = new (pool) AST::Expression(sym(1).Expression, sym(3).Expression);
+ AST::CommaExpression *node
+ = new (pool) AST::CommaExpression(sym(1).Expression, sym(3).Expression);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
diff --git a/src/qml/parser/qqmljsast.cpp b/src/qml/parser/qqmljsast.cpp
index f20fe016ff..09e396369a 100644
--- a/src/qml/parser/qqmljsast.cpp
+++ b/src/qml/parser/qqmljsast.cpp
@@ -129,7 +129,7 @@ FormalParameterList *ExpressionNode::reparseAsFormalParameterList(MemoryPool *po
{
AST::ExpressionNode *expr = this;
AST::FormalParameterList *f = nullptr;
- if (AST::Expression *commaExpr = AST::cast<AST::Expression *>(expr)) {
+ if (AST::CommaExpression *commaExpr = AST::cast<AST::CommaExpression *>(expr)) {
f = commaExpr->left->reparseAsFormalParameterList(pool);
if (!f)
return nullptr;
@@ -713,7 +713,7 @@ void ConditionalExpression::accept0(BaseVisitor *visitor)
visitor->endVisit(this);
}
-void Expression::accept0(BaseVisitor *visitor)
+void CommaExpression::accept0(BaseVisitor *visitor)
{
if (visitor->visit(this)) {
accept(left, visitor);
diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h
index a6a0f3a5c0..60ae4028e4 100644
--- a/src/qml/parser/qqmljsast_p.h
+++ b/src/qml/parser/qqmljsast_p.h
@@ -1657,12 +1657,12 @@ public:
SourceLocation colonToken;
};
-class QML_PARSER_EXPORT Expression: public ExpressionNode // ### rename
+class QML_PARSER_EXPORT CommaExpression: public ExpressionNode
{
public:
QQMLJS_DECLARE_AST_NODE(Expression)
- Expression(ExpressionNode *l, ExpressionNode *r):
+ CommaExpression(ExpressionNode *l, ExpressionNode *r):
left (l), right (r) { kind = K; }
void accept0(BaseVisitor *visitor) override;
@@ -1678,6 +1678,8 @@ public:
ExpressionNode *right;
SourceLocation commaToken;
};
+// Don't break other users of the parser
+using Expression = CommaExpression;
class QML_PARSER_EXPORT Block: public Statement
{
diff --git a/src/qml/parser/qqmljsastfwd_p.h b/src/qml/parser/qqmljsastfwd_p.h
index c87f67c67e..43179d9f26 100644
--- a/src/qml/parser/qqmljsastfwd_p.h
+++ b/src/qml/parser/qqmljsastfwd_p.h
@@ -72,7 +72,7 @@ class TildeExpression;
class NotExpression;
class BinaryExpression;
class ConditionalExpression;
-class Expression; // ### rename
+class CommaExpression;
class YieldExpression;
class Block;
class LeftHandSideExpression;
diff --git a/src/qml/parser/qqmljsastvisitor_p.h b/src/qml/parser/qqmljsastvisitor_p.h
index 540d21d725..228537ab5a 100644
--- a/src/qml/parser/qqmljsastvisitor_p.h
+++ b/src/qml/parser/qqmljsastvisitor_p.h
@@ -91,7 +91,7 @@ QT_BEGIN_NAMESPACE
X(NotExpression) \
X(BinaryExpression) \
X(ConditionalExpression) \
- X(Expression) \
+ X(CommaExpression) \
X(Block) \
X(StatementList) \
X(VariableStatement) \
diff --git a/src/qmldom/qqmldomastcreator.cpp b/src/qmldom/qqmldomastcreator.cpp
index 3fec3d0211..4c951f2761 100644
--- a/src/qmldom/qqmldomastcreator.cpp
+++ b/src/qmldom/qqmldomastcreator.cpp
@@ -2813,14 +2813,12 @@ void QQmlDomAstCreator::endVisit(AST::BreakStatement *statement)
pushScriptElement(current);
}
-// note: thats for comma expressions
-bool QQmlDomAstCreator::visit(AST::Expression *)
+bool QQmlDomAstCreator::visit(AST::CommaExpression *)
{
return m_enableScriptExpressions;
}
-// note: thats for comma expressions
-void QQmlDomAstCreator::endVisit(AST::Expression *commaExpression)
+void QQmlDomAstCreator::endVisit(AST::CommaExpression *commaExpression)
{
if (!m_enableScriptExpressions)
return;
diff --git a/src/qmldom/qqmldomastcreator_p.h b/src/qmldom/qqmldomastcreator_p.h
index 3b81f2c106..1092535c6d 100644
--- a/src/qmldom/qqmldomastcreator_p.h
+++ b/src/qmldom/qqmldomastcreator_p.h
@@ -461,8 +461,8 @@ public:
bool visit(AST::BreakStatement *) override;
void endVisit(AST::BreakStatement *) override;
- bool visit(AST::Expression *) override;
- void endVisit(AST::Expression *) override;
+ bool visit(AST::CommaExpression *) override;
+ void endVisit(AST::CommaExpression *) override;
bool visit(AST::ConditionalExpression *) override;
void endVisit(AST::ConditionalExpression *) override;
diff --git a/src/qmldom/qqmldomastdumper.cpp b/src/qmldom/qqmldomastdumper.cpp
index afe9412fd7..0a8fb17329 100644
--- a/src/qmldom/qqmldomastdumper.cpp
+++ b/src/qmldom/qqmldomastdumper.cpp
@@ -638,12 +638,12 @@ public:
}
void endVisit(AST::ConditionalExpression *) override { stop(u"ConditionalExpression"); }
- bool visit(AST::Expression *el) override {
+ bool visit(AST::CommaExpression *el) override {
start(QLatin1String("Expression commaToken=%1")
.arg(loc(el->commaToken)));
return true;
}
- void endVisit(AST::Expression *) override { stop(u"Expression"); }
+ void endVisit(AST::CommaExpression *) override { stop(u"Expression"); }
bool visit(AST::Block *el) override {
start(QLatin1String("Block lbraceToken=%1 rbraceToken=%2")
diff --git a/src/qmldom/qqmldomreformatter.cpp b/src/qmldom/qqmldomreformatter.cpp
index d58ab39ce5..1f8337ac71 100644
--- a/src/qmldom/qqmldomreformatter.cpp
+++ b/src/qmldom/qqmldomreformatter.cpp
@@ -944,7 +944,7 @@ bool ScriptFormatter::visit(ComputedPropertyName *)
out("[");
return true;
}
-bool ScriptFormatter::visit(Expression *el)
+bool ScriptFormatter::visit(CommaExpression *el)
{
accept(el->left);
out(",");
diff --git a/src/qmldom/qqmldomreformatter_p.h b/src/qmldom/qqmldomreformatter_p.h
index a13425dec7..fc665db0b0 100644
--- a/src/qmldom/qqmldomreformatter_p.h
+++ b/src/qmldom/qqmldomreformatter_p.h
@@ -189,7 +189,7 @@ protected:
bool visit(AST::SuperLiteral *) override;
bool visit(AST::ComputedPropertyName *) override;
- bool visit(AST::Expression *el) override;
+ bool visit(AST::CommaExpression *el) override;
bool visit(AST::ExpressionStatement *el) override;
bool visit(AST::ClassDeclaration *ast) override;