From 561a7bf35b96ffe70ebafc3876e965ef41b4441d Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Fri, 16 Apr 2010 11:15:55 +0200 Subject: Fixed parsing of inner labelled statements. The JS grammar is ambigious and the following statement can be parsed as an object-literal followed by an inserted semicolon or as two labelled statements. outer: { inner: {} } In the old days we used to resolve the conflict by reducing the statement to an expression statement but this was wrong so now we prefer the labelled statement. As nice side effect, we pass two more tests in tests/auto/declarative/parserstress. Task-number: QTBUG-8108 --- src/declarative/qml/parser/qdeclarativejs.g | 2 +- src/declarative/qml/parser/qdeclarativejsgrammar.cpp | 6 +++--- tests/auto/declarative/parserstress/tst_parserstress.cpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/declarative/qml/parser/qdeclarativejs.g b/src/declarative/qml/parser/qdeclarativejs.g index ba9338e..1b66ba0 100644 --- a/src/declarative/qml/parser/qdeclarativejs.g +++ b/src/declarative/qml/parser/qdeclarativejs.g @@ -1376,7 +1376,7 @@ case $rule_number: { } break; ./ -PropertyName: T_IDENTIFIER %prec REDUCE_HERE ; +PropertyName: T_IDENTIFIER %prec SHIFT_THERE ; /. case $rule_number: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); diff --git a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp index 52e979a..b87d8f4 100644 --- a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp +++ b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ // This file was generated by qlalr - DO NOT EDIT! -#include "private/qdeclarativejsgrammar_p.h" +#include "qdeclarativejsgrammar_p.h" QT_BEGIN_NAMESPACE @@ -346,9 +346,9 @@ const short QDeclarativeJSGrammar::action_index [] = { const short QDeclarativeJSGrammar::action_info [] = { 399, 352, 345, -101, 343, 457, 440, 403, 257, -112, - -125, -131, -123, -98, -120, 348, -128, 389, 453, 391, + -125, -131, -123, 346, -120, 348, -128, 389, 453, 391, 416, 401, 408, 563, -101, -123, 416, -120, 539, -131, - -98, -112, -125, 348, 257, 99, 71, 645, 621, 101, + 346, -112, -125, 348, 257, 99, 71, 645, 621, 101, -128, 440, 141, 621, 164, 431, 539, 430, 453, 573, 457, 444, 440, 424, 71, 424, 101, 446, 559, 420, 424, 448, 539, 440, 570, 539, 466, 527, 312, 346, diff --git a/tests/auto/declarative/parserstress/tst_parserstress.cpp b/tests/auto/declarative/parserstress/tst_parserstress.cpp index 41c0a1b..971496d 100644 --- a/tests/auto/declarative/parserstress/tst_parserstress.cpp +++ b/tests/auto/declarative/parserstress/tst_parserstress.cpp @@ -65,7 +65,7 @@ QStringList tst_parserstress::findJSFiles(const QDir &d) { QStringList rv; - QStringList files = d.entryList(QStringList() << QLatin1String("*.js"), + QStringList files = d.entryList(QStringList() << QLatin1String("*.js"), QDir::Files); foreach (const QString &file, files) { if (file == "browser.js") @@ -73,7 +73,7 @@ QStringList tst_parserstress::findJSFiles(const QDir &d) rv << d.absoluteFilePath(file); } - QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | + QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks); foreach (const QString &dir, dirs) { QDir sub = d; @@ -132,7 +132,7 @@ void tst_parserstress::ecmascript() component.setData(qmlData, QUrl::fromLocalFile(SRCDIR + QString("/dummy.qml"))); QSet failingTests; failingTests << "uc-003.js" << "uc-005.js" << "regress-352044-02-n.js" - << "regress-334158.js" << "regress-58274.js" << "dowhile-006.js" << "dowhile-005.js"; + << "regress-334158.js" << "regress-58274.js"; QFileInfo info(file); foreach (const QString &failing, failingTests) { if (info.fileName().endsWith(failing)) { -- cgit v0.12