From 4646acad0db369302d08a1b83e1971be31c1df4f Mon Sep 17 00:00:00 2001 From: Marco Benelli Date: Tue, 16 Oct 2018 15:32:58 +0200 Subject: qmljs: update parser Update the qtcreator qmljs parser to the one of Qt 5.12. It supports EcmaScript 7. Task-number: QTCREATORBUG-20341 Change-Id: I0d1cff71402ba17e22cde6b46c65614e162280de Reviewed-by: Erik Verbruggen --- src/libs/qmljs/jsoncheck.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/libs/qmljs/jsoncheck.cpp') diff --git a/src/libs/qmljs/jsoncheck.cpp b/src/libs/qmljs/jsoncheck.cpp index 2649f71a01..3940f46099 100644 --- a/src/libs/qmljs/jsoncheck.cpp +++ b/src/libs/qmljs/jsoncheck.cpp @@ -84,7 +84,7 @@ void JsonCheck::postVisit(Node *) analysis()->m_ranking += previous.m_ranking; } -bool JsonCheck::visit(ObjectLiteral *ast) +bool JsonCheck::visit(ObjectPattern *ast) { if (!proceedCheck(JsonValue::Object, ast->lbraceToken)) return false; @@ -96,8 +96,8 @@ bool JsonCheck::visit(ObjectLiteral *ast) return false; QSet propertiesFound; - for (PropertyAssignmentList *it = ast->properties; it; it = it->next) { - PropertyNameAndValue *assignment = AST::cast(it->assignment); + for (PatternPropertyList *it = ast->properties; it; it = it->next) { + PatternProperty *assignment = AST::cast(it->property); StringLiteralPropertyName *literalName = cast(assignment->name); if (literalName) { const QString &propertyName = literalName->id.toString(); @@ -106,7 +106,7 @@ bool JsonCheck::visit(ObjectLiteral *ast) propertiesFound.insert(propertyName); // Sec. 5.2: "... each property definition's value MUST be a schema..." m_schema->enterNestedPropertySchema(propertyName); - processSchema(assignment->value); + processSchema(assignment->initializer); m_schema->leaveNestedSchema(); } else { analysis()->m_messages.append(Message(ErrInvalidPropertyName, @@ -144,7 +144,7 @@ bool JsonCheck::visit(ObjectLiteral *ast) return false; } -bool JsonCheck::visit(ArrayLiteral *ast) +bool JsonCheck::visit(ArrayPattern *ast) { if (!proceedCheck(JsonValue::Array, ast->firstSourceLocation())) return false; @@ -155,21 +155,21 @@ bool JsonCheck::visit(ArrayLiteral *ast) // Sec. 5.5: "When this attribute value is a schema... all the items in the array MUST // be valid according to the schema." m_schema->enterNestedItemSchema(); - for (ElementList *element = ast->elements; element; element = element->next) - processSchema(element->expression); + for (PatternElementList *element = ast->elements; element; element = element->next) + processSchema(element->element->initializer); m_schema->leaveNestedSchema(); } else if (m_schema->hasItemArraySchema()) { // Sec. 5.5: "When this attribute value is an array of schemas... each position in the // instance array MUST conform to the schema in the corresponding position for this array." int current = 0; const int arraySize = m_schema->itemArraySchemaSize(); - for (ElementList *element = ast->elements; element; element = element->next, ++current) { + for (PatternElementList *element = ast->elements; element; element = element->next, ++current) { if (current < arraySize) { if (m_schema->maybeEnterNestedArraySchema(current)) { - processSchema(element->expression); + processSchema(element->element->initializer); m_schema->leaveNestedSchema(); } else { - Node::accept(element->expression, this); + Node::accept(element->element->initializer, this); } } else { // TODO: Handle additionalItems. -- cgit v1.2.1