forked from qt-creator/qt-creator
QmlJS: Update to new QmlJS parser.
UiPublicMember is now initialized with a statement.
This commit is contained in:
24
src/libs/qmljs/parser/changeLicense.py
Executable file
24
src/libs/qmljs/parser/changeLicense.py
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
if not len(sys.argv) >= 3:
|
||||||
|
print("Usage: %s license files..." % os.path.basename(sys.argv[0]))
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
licenseFileName = sys.argv[1]
|
||||||
|
licenseText = ""
|
||||||
|
with open(licenseFileName, 'r') as f:
|
||||||
|
licenseText = f.read()
|
||||||
|
licenseText = licenseText[0:licenseText.find('*/')]
|
||||||
|
|
||||||
|
files = sys.argv[2:]
|
||||||
|
for fileName in files:
|
||||||
|
with open(fileName, 'r') as f:
|
||||||
|
text = f.read()
|
||||||
|
oldEnd = text.find('*/')
|
||||||
|
if oldEnd == -1:
|
||||||
|
oldEnd = 0
|
||||||
|
text = licenseText + text[oldEnd:]
|
||||||
|
with open(fileName, 'w') as f:
|
||||||
|
f.write(text)
|
@@ -12,3 +12,7 @@ done
|
|||||||
|
|
||||||
# export QmlDirParser
|
# export QmlDirParser
|
||||||
perl -p -0777 -i -e 's/QT_BEGIN_NAMESPACE\n\nclass QmlError;\nclass QmlDirParser/#include "qmljsglobal_p.h"\n\nQT_BEGIN_NAMESPACE\n\nclass QmlError;\nclass QML_PARSER_EXPORT QmlDirParser/' qmldirparser_p.h
|
perl -p -0777 -i -e 's/QT_BEGIN_NAMESPACE\n\nclass QmlError;\nclass QmlDirParser/#include "qmljsglobal_p.h"\n\nQT_BEGIN_NAMESPACE\n\nclass QmlError;\nclass QML_PARSER_EXPORT QmlDirParser/' qmldirparser_p.h
|
||||||
|
|
||||||
|
./changeLicense.py $me/../qmljs_global.h qml*.{cpp,h}
|
||||||
|
|
||||||
|
echo "Fix licenses in qmljs.g!"
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
@@ -132,7 +133,7 @@ bool QmlDirParser::parse()
|
|||||||
} else if (sections[0] == QLatin1String("plugin")) {
|
} else if (sections[0] == QLatin1String("plugin")) {
|
||||||
if (sectionCount < 2) {
|
if (sectionCount < 2) {
|
||||||
reportError(lineNumber, -1,
|
reportError(lineNumber, -1,
|
||||||
QString::fromUtf8("plugin directive requires 2 arguments, but %1 were provided").arg(sectionCount + 1));
|
QString::fromUtf8("plugin directive requires one or two arguments, but %1 were provided").arg(sectionCount - 1));
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -144,12 +145,22 @@ bool QmlDirParser::parse()
|
|||||||
} else if (sections[0] == QLatin1String("internal")) {
|
} else if (sections[0] == QLatin1String("internal")) {
|
||||||
if (sectionCount != 3) {
|
if (sectionCount != 3) {
|
||||||
reportError(lineNumber, -1,
|
reportError(lineNumber, -1,
|
||||||
QString::fromUtf8("internal types require 2 arguments, but %1 were provided").arg(sectionCount + 1));
|
QString::fromUtf8("internal types require 2 arguments, but %1 were provided").arg(sectionCount - 1));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Component entry(sections[1], sections[2], -1, -1);
|
Component entry(sections[1], sections[2], -1, -1);
|
||||||
entry.internal = true;
|
entry.internal = true;
|
||||||
_components.append(entry);
|
_components.append(entry);
|
||||||
|
} else if (sections[0] == QLatin1String("typeinfo")) {
|
||||||
|
if (sectionCount != 2) {
|
||||||
|
reportError(lineNumber, -1,
|
||||||
|
QString::fromUtf8("typeinfo requires 1 argument, but %1 were provided").arg(sectionCount - 1));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#ifdef QT_CREATOR
|
||||||
|
TypeInfo typeInfo(sections[1]);
|
||||||
|
_typeInfos.append(typeInfo);
|
||||||
|
#endif
|
||||||
|
|
||||||
} else if (sectionCount == 2) {
|
} else if (sectionCount == 2) {
|
||||||
// No version specified (should only be used for relative qmldir files)
|
// No version specified (should only be used for relative qmldir files)
|
||||||
@@ -179,7 +190,7 @@ bool QmlDirParser::parse()
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
reportError(lineNumber, -1,
|
reportError(lineNumber, -1,
|
||||||
QString::fromUtf8("a component declaration requires 3 arguments, but %1 were provided").arg(sectionCount + 1));
|
QString::fromUtf8("a component declaration requires two or three arguments, but %1 were provided").arg(sectionCount));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,4 +230,11 @@ QList<QmlDirParser::Component> QmlDirParser::components() const
|
|||||||
return _components;
|
return _components;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef QT_CREATOR
|
||||||
|
QList<QmlDirParser::TypeInfo> QmlDirParser::typeInfos() const
|
||||||
|
{
|
||||||
|
return _typeInfos;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
@@ -101,6 +102,19 @@ public:
|
|||||||
QList<Component> components() const;
|
QList<Component> components() const;
|
||||||
QList<Plugin> plugins() const;
|
QList<Plugin> plugins() const;
|
||||||
|
|
||||||
|
#ifdef QT_CREATOR
|
||||||
|
struct TypeInfo
|
||||||
|
{
|
||||||
|
TypeInfo() {}
|
||||||
|
TypeInfo(const QString &fileName)
|
||||||
|
: fileName(fileName) {}
|
||||||
|
|
||||||
|
QString fileName;
|
||||||
|
};
|
||||||
|
|
||||||
|
QList<TypeInfo> typeInfos() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void reportError(int line, int column, const QString &message);
|
void reportError(int line, int column, const QString &message);
|
||||||
|
|
||||||
@@ -110,6 +124,9 @@ private:
|
|||||||
QString _source;
|
QString _source;
|
||||||
QList<Component> _components;
|
QList<Component> _components;
|
||||||
QList<Plugin> _plugins;
|
QList<Plugin> _plugins;
|
||||||
|
#ifdef QT_CREATOR
|
||||||
|
QList<TypeInfo> _typeInfos;
|
||||||
|
#endif
|
||||||
unsigned _isParsed: 1;
|
unsigned _isParsed: 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
--
|
--
|
||||||
-- Contact: Nokia Corporation (info@qt.nokia.com)
|
-- Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
--
|
--
|
||||||
|
--
|
||||||
-- GNU Lesser General Public License Usage
|
-- GNU Lesser General Public License Usage
|
||||||
--
|
--
|
||||||
-- This file may be used under the terms of the GNU Lesser General Public
|
-- This file may be used under the terms of the GNU Lesser General Public
|
||||||
@@ -97,6 +98,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
@@ -120,7 +122,6 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include <QtCore/QtDebug>
|
#include <QtCore/QtDebug>
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
|
|
||||||
@@ -141,6 +142,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
@@ -165,7 +167,6 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// W A R N I N G
|
// W A R N I N G
|
||||||
// -------------
|
// -------------
|
||||||
@@ -772,19 +773,14 @@ case $rule_number: {
|
|||||||
} break;
|
} break;
|
||||||
./
|
./
|
||||||
|
|
||||||
UiObjectMember: UiQualifiedId T_COLON Block ;
|
UiScriptStatement: Block ;
|
||||||
/.case $rule_number:./
|
UiScriptStatement: EmptyStatement ;
|
||||||
|
UiScriptStatement: ExpressionStatement ;
|
||||||
UiObjectMember: UiQualifiedId T_COLON EmptyStatement ;
|
UiScriptStatement: IfStatement ; --- ### do we really want if statement in a binding?
|
||||||
/.case $rule_number:./
|
|
||||||
|
|
||||||
UiObjectMember: UiQualifiedId T_COLON ExpressionStatement ;
|
|
||||||
/.case $rule_number:./
|
|
||||||
|
|
||||||
UiObjectMember: UiQualifiedId T_COLON IfStatement ; --- ### do we really want if statement in a binding?
|
|
||||||
/.case $rule_number:./
|
|
||||||
|
|
||||||
|
UiObjectMember: UiQualifiedId T_COLON UiScriptStatement ;
|
||||||
/.
|
/.
|
||||||
|
case $rule_number:
|
||||||
{
|
{
|
||||||
AST::UiScriptBinding *node = makeAstNode<AST::UiScriptBinding> (driver->nodePool(),
|
AST::UiScriptBinding *node = makeAstNode<AST::UiScriptBinding> (driver->nodePool(),
|
||||||
sym(1).UiQualifiedId, sym(3).Statement);
|
sym(1).UiQualifiedId, sym(3).Statement);
|
||||||
@@ -912,51 +908,45 @@ case $rule_number: {
|
|||||||
} break;
|
} break;
|
||||||
./
|
./
|
||||||
|
|
||||||
UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_AUTOMATIC_SEMICOLON ;
|
UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ;
|
||||||
UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_SEMICOLON ;
|
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval,
|
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval,
|
||||||
sym(5).Expression);
|
sym(5).Statement);
|
||||||
node->propertyToken = loc(1);
|
node->propertyToken = loc(1);
|
||||||
node->typeToken = loc(2);
|
node->typeToken = loc(2);
|
||||||
node->identifierToken = loc(3);
|
node->identifierToken = loc(3);
|
||||||
node->colonToken = loc(4);
|
node->colonToken = loc(4);
|
||||||
node->semicolonToken = loc(6);
|
|
||||||
sym(1).Node = node;
|
sym(1).Node = node;
|
||||||
} break;
|
} break;
|
||||||
./
|
./
|
||||||
|
|
||||||
UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_AUTOMATIC_SEMICOLON ;
|
UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ;
|
||||||
UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_SEMICOLON ;
|
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
|
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
|
||||||
sym(6).Expression);
|
sym(6).Statement);
|
||||||
node->isReadonlyMember = true;
|
node->isReadonlyMember = true;
|
||||||
node->readonlyToken = loc(1);
|
node->readonlyToken = loc(1);
|
||||||
node->propertyToken = loc(2);
|
node->propertyToken = loc(2);
|
||||||
node->typeToken = loc(3);
|
node->typeToken = loc(3);
|
||||||
node->identifierToken = loc(4);
|
node->identifierToken = loc(4);
|
||||||
node->colonToken = loc(5);
|
node->colonToken = loc(5);
|
||||||
node->semicolonToken = loc(7);
|
|
||||||
sym(1).Node = node;
|
sym(1).Node = node;
|
||||||
} break;
|
} break;
|
||||||
./
|
./
|
||||||
|
|
||||||
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_AUTOMATIC_SEMICOLON ;
|
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ;
|
||||||
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_SEMICOLON ;
|
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
|
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
|
||||||
sym(6).Expression);
|
sym(6).Statement);
|
||||||
node->isDefaultMember = true;
|
node->isDefaultMember = true;
|
||||||
node->defaultToken = loc(1);
|
node->defaultToken = loc(1);
|
||||||
node->propertyToken = loc(2);
|
node->propertyToken = loc(2);
|
||||||
node->typeToken = loc(3);
|
node->typeToken = loc(3);
|
||||||
node->identifierToken = loc(4);
|
node->identifierToken = loc(4);
|
||||||
node->colonToken = loc(5);
|
node->colonToken = loc(5);
|
||||||
node->semicolonToken = loc(7);
|
|
||||||
sym(1).Node = node;
|
sym(1).Node = node;
|
||||||
} break;
|
} break;
|
||||||
./
|
./
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
@@ -826,7 +827,7 @@ void UiFormal::accept0(Visitor *visitor)
|
|||||||
void UiPublicMember::accept0(Visitor *visitor)
|
void UiPublicMember::accept0(Visitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
accept(expression, visitor);
|
accept(statement, visitor);
|
||||||
accept(binding, visitor);
|
accept(binding, visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
@@ -2332,13 +2333,13 @@ public:
|
|||||||
|
|
||||||
UiPublicMember(NameId *memberType,
|
UiPublicMember(NameId *memberType,
|
||||||
NameId *name)
|
NameId *name)
|
||||||
: type(Property), typeModifier(0), memberType(memberType), name(name), expression(0), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0)
|
: type(Property), typeModifier(0), memberType(memberType), name(name), statement(0), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0)
|
||||||
{ kind = K; }
|
{ kind = K; }
|
||||||
|
|
||||||
UiPublicMember(NameId *memberType,
|
UiPublicMember(NameId *memberType,
|
||||||
NameId *name,
|
NameId *name,
|
||||||
ExpressionNode *expression)
|
Statement *statement)
|
||||||
: type(Property), typeModifier(0), memberType(memberType), name(name), expression(expression), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0)
|
: type(Property), typeModifier(0), memberType(memberType), name(name), statement(statement), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0)
|
||||||
{ kind = K; }
|
{ kind = K; }
|
||||||
|
|
||||||
virtual SourceLocation firstSourceLocation() const
|
virtual SourceLocation firstSourceLocation() const
|
||||||
@@ -2366,7 +2367,7 @@ public:
|
|||||||
NameId *typeModifier;
|
NameId *typeModifier;
|
||||||
NameId *memberType;
|
NameId *memberType;
|
||||||
NameId *name;
|
NameId *name;
|
||||||
ExpressionNode *expression; // initialized with a JS expression
|
Statement *statement; // initialized with a JS expression
|
||||||
UiObjectMember *binding; // initialized with a QML object or array.
|
UiObjectMember *binding; // initialized with a QML object or array.
|
||||||
bool isDefaultMember;
|
bool isDefaultMember;
|
||||||
bool isReadonlyMember;
|
bool isReadonlyMember;
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
@@ -78,12 +79,6 @@ uint qHash(const QmlJS::NameId &id);
|
|||||||
|
|
||||||
} // end of namespace QmlJS
|
} // end of namespace QmlJS
|
||||||
|
|
||||||
#if defined(Q_CC_MSVC) && _MSC_VER <= 1300
|
|
||||||
//this ensures that code outside QmlJS can use the hash function
|
|
||||||
//it also a workaround for some compilers
|
|
||||||
inline uint qHash(const QmlJS::NameId &nameId) { return QmlJS::qHash(nameId); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
|
|
||||||
class Lexer;
|
class Lexer;
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
@@ -28,7 +29,6 @@
|
|||||||
** Nokia at info@qt.nokia.com.
|
** Nokia at info@qt.nokia.com.
|
||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef QMLJSGLOBAL_P_H
|
#ifndef QMLJSGLOBAL_P_H
|
||||||
#define QMLJSGLOBAL_P_H
|
#define QMLJSGLOBAL_P_H
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
#else // !QT_CREATOR
|
#else // !QT_CREATOR
|
||||||
# define QT_QML_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
|
# define QT_QML_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
|
||||||
# define QT_QML_END_NAMESPACE QT_END_NAMESPACE
|
# define QT_QML_END_NAMESPACE QT_END_NAMESPACE
|
||||||
# define QML_PARSER_EXPORT
|
# define QML_PARSER_EXPORT Q_AUTOTEST_EXPORT
|
||||||
#endif // QT_CREATOR
|
#endif // QT_CREATOR
|
||||||
|
|
||||||
#endif // QMLJSGLOBAL_P_H
|
#endif // QMLJSGLOBAL_P_H
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
@@ -154,15 +155,15 @@ public:
|
|||||||
T_XOR = 79,
|
T_XOR = 79,
|
||||||
T_XOR_EQ = 80,
|
T_XOR_EQ = 80,
|
||||||
|
|
||||||
ACCEPT_STATE = 645,
|
ACCEPT_STATE = 640,
|
||||||
RULE_COUNT = 347,
|
RULE_COUNT = 345,
|
||||||
STATE_COUNT = 646,
|
STATE_COUNT = 641,
|
||||||
TERMINAL_COUNT = 101,
|
TERMINAL_COUNT = 101,
|
||||||
NON_TERMINAL_COUNT = 106,
|
NON_TERMINAL_COUNT = 107,
|
||||||
|
|
||||||
GOTO_INDEX_OFFSET = 646,
|
GOTO_INDEX_OFFSET = 641,
|
||||||
GOTO_INFO_OFFSET = 2714,
|
GOTO_INFO_OFFSET = 2787,
|
||||||
GOTO_CHECK_OFFSET = 2714
|
GOTO_CHECK_OFFSET = 2787
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const spell [];
|
static const char *const spell [];
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@
|
|||||||
**
|
**
|
||||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
**
|
**
|
||||||
|
**
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
@@ -225,9 +226,9 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define J_SCRIPT_REGEXPLITERAL_RULE1 78
|
#define J_SCRIPT_REGEXPLITERAL_RULE1 76
|
||||||
|
|
||||||
#define J_SCRIPT_REGEXPLITERAL_RULE2 79
|
#define J_SCRIPT_REGEXPLITERAL_RULE2 77
|
||||||
|
|
||||||
QT_QML_END_NAMESPACE
|
QT_QML_END_NAMESPACE
|
||||||
|
|
||||||
|
@@ -745,6 +745,12 @@ bool Check::visit(ExpressionStatement *ast)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (UiPublicMember *member = cast<UiPublicMember *>(p)) {
|
||||||
|
if (!cast<Block *>(member->statement)) {
|
||||||
|
ok = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3276,7 +3276,7 @@ bool ASTPropertyReference::getSourceLocation(QString *fileName, int *line, int *
|
|||||||
|
|
||||||
const Value *ASTPropertyReference::value(const Context *context) const
|
const Value *ASTPropertyReference::value(const Context *context) const
|
||||||
{
|
{
|
||||||
if (_ast->expression
|
if (_ast->statement
|
||||||
&& (!_ast->memberType || _ast->memberType->asString() == QLatin1String("variant")
|
&& (!_ast->memberType || _ast->memberType->asString() == QLatin1String("variant")
|
||||||
|| _ast->memberType->asString() == QLatin1String("alias"))) {
|
|| _ast->memberType->asString() == QLatin1String("alias"))) {
|
||||||
|
|
||||||
@@ -3288,11 +3288,11 @@ const Value *ASTPropertyReference::value(const Context *context) const
|
|||||||
QmlJS::ScopeBuilder builder(&localContext, doc);
|
QmlJS::ScopeBuilder builder(&localContext, doc);
|
||||||
builder.initializeRootScope();
|
builder.initializeRootScope();
|
||||||
|
|
||||||
int offset = _ast->expression->firstSourceLocation().begin();
|
int offset = _ast->statement->firstSourceLocation().begin();
|
||||||
builder.push(ScopeAstPath(doc)(offset));
|
builder.push(ScopeAstPath(doc)(offset));
|
||||||
|
|
||||||
Evaluate check(&localContext);
|
Evaluate check(&localContext);
|
||||||
return check(_ast->expression);
|
return check(_ast->statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_ast->memberType)
|
if (_ast->memberType)
|
||||||
|
@@ -330,12 +330,12 @@ void Rewriter::replaceMemberValue(UiObjectMember *propertyMember,
|
|||||||
startOffset = arrayBinding->lbracketToken.offset;
|
startOffset = arrayBinding->lbracketToken.offset;
|
||||||
endOffset = arrayBinding->rbracketToken.end();
|
endOffset = arrayBinding->rbracketToken.end();
|
||||||
} else if (UiPublicMember *publicMember = AST::cast<UiPublicMember*>(propertyMember)) {
|
} else if (UiPublicMember *publicMember = AST::cast<UiPublicMember*>(propertyMember)) {
|
||||||
if (publicMember->expression) {
|
if (publicMember->statement) {
|
||||||
startOffset = publicMember->expression->firstSourceLocation().offset;
|
startOffset = publicMember->statement->firstSourceLocation().offset;
|
||||||
if (publicMember->semicolonToken.isValid())
|
if (publicMember->semicolonToken.isValid())
|
||||||
endOffset = publicMember->semicolonToken.end();
|
endOffset = publicMember->semicolonToken.end();
|
||||||
else
|
else
|
||||||
endOffset = publicMember->expression->lastSourceLocation().offset;
|
endOffset = publicMember->statement->lastSourceLocation().offset;
|
||||||
} else {
|
} else {
|
||||||
startOffset = publicMember->lastSourceLocation().end();
|
startOffset = publicMember->lastSourceLocation().end();
|
||||||
endOffset = startOffset;
|
endOffset = startOffset;
|
||||||
|
@@ -147,12 +147,12 @@ void ChangePropertyVisitor::replaceMemberValue(UiObjectMember *propertyMember, b
|
|||||||
startOffset = arrayBinding->lbracketToken.offset;
|
startOffset = arrayBinding->lbracketToken.offset;
|
||||||
endOffset = arrayBinding->rbracketToken.end();
|
endOffset = arrayBinding->rbracketToken.end();
|
||||||
} else if (UiPublicMember *publicMember = AST::cast<UiPublicMember*>(propertyMember)) {
|
} else if (UiPublicMember *publicMember = AST::cast<UiPublicMember*>(propertyMember)) {
|
||||||
if (publicMember->expression) {
|
if (publicMember->statement) {
|
||||||
startOffset = publicMember->expression->firstSourceLocation().offset;
|
startOffset = publicMember->statement->firstSourceLocation().offset;
|
||||||
if (publicMember->semicolonToken.isValid())
|
if (publicMember->semicolonToken.isValid())
|
||||||
endOffset = publicMember->semicolonToken.end();
|
endOffset = publicMember->semicolonToken.end();
|
||||||
else
|
else
|
||||||
endOffset = publicMember->expression->lastSourceLocation().offset;
|
endOffset = publicMember->statement->lastSourceLocation().offset;
|
||||||
} else {
|
} else {
|
||||||
startOffset = publicMember->lastSourceLocation().end();
|
startOffset = publicMember->lastSourceLocation().end();
|
||||||
endOffset = startOffset;
|
endOffset = startOffset;
|
||||||
|
@@ -202,16 +202,21 @@ static bool isLiteralValue(ExpressionNode *expr)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isLiteralValue(Statement *stmt)
|
||||||
|
{
|
||||||
|
ExpressionStatement *exprStmt = cast<ExpressionStatement *>(stmt);
|
||||||
|
if (exprStmt)
|
||||||
|
return isLiteralValue(exprStmt->expression);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool isLiteralValue(UiScriptBinding *script)
|
static inline bool isLiteralValue(UiScriptBinding *script)
|
||||||
{
|
{
|
||||||
if (!script || !script->statement)
|
if (!script || !script->statement)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ExpressionStatement *exprStmt = cast<ExpressionStatement *>(script->statement);
|
return isLiteralValue(script->statement);
|
||||||
if (exprStmt)
|
|
||||||
return isLiteralValue(exprStmt->expression);
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int propertyType(const QString &typeName)
|
static inline int propertyType(const QString &typeName)
|
||||||
@@ -852,13 +857,13 @@ void TextToModelMerger::syncNode(ModelNode &modelNode,
|
|||||||
|
|
||||||
const QString astName = property->name->asString();
|
const QString astName = property->name->asString();
|
||||||
QString astValue;
|
QString astValue;
|
||||||
if (property->expression)
|
if (property->statement)
|
||||||
astValue = textAt(context->doc(),
|
astValue = textAt(context->doc(),
|
||||||
property->expression->firstSourceLocation(),
|
property->statement->firstSourceLocation(),
|
||||||
property->expression->lastSourceLocation());
|
property->statement->lastSourceLocation());
|
||||||
const QString astType = property->memberType->asString();
|
const QString astType = property->memberType->asString();
|
||||||
AbstractProperty modelProperty = modelNode.property(astName);
|
AbstractProperty modelProperty = modelNode.property(astName);
|
||||||
if (!property->expression || isLiteralValue(property->expression)) {
|
if (!property->statement || isLiteralValue(property->statement)) {
|
||||||
const QVariant variantValue = convertDynamicPropertyValueToVariant(astValue, astType);
|
const QVariant variantValue = convertDynamicPropertyValueToVariant(astValue, astType);
|
||||||
syncVariantProperty(modelProperty, variantValue, astType, differenceHandler);
|
syncVariantProperty(modelProperty, variantValue, astType, differenceHandler);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -181,13 +181,13 @@ bool HoverHandler::matchColorItem(const LookupContext::Ptr &lookupContext,
|
|||||||
}
|
}
|
||||||
} else if (const AST::UiPublicMember *publicMember =
|
} else if (const AST::UiPublicMember *publicMember =
|
||||||
AST::cast<const AST::UiPublicMember *>(member)) {
|
AST::cast<const AST::UiPublicMember *>(member)) {
|
||||||
if (publicMember->name && posIsInSource(pos, publicMember->expression)) {
|
if (publicMember->name && posIsInSource(pos, publicMember->statement)) {
|
||||||
value = lookupContext->context()->lookup(publicMember->name->asString());
|
value = lookupContext->context()->lookup(publicMember->name->asString());
|
||||||
if (const Interpreter::Reference *ref = value->asReference())
|
if (const Interpreter::Reference *ref = value->asReference())
|
||||||
value = lookupContext->context()->lookupReference(ref);
|
value = lookupContext->context()->lookupReference(ref);
|
||||||
color = textAt(qmlDocument,
|
color = textAt(qmlDocument,
|
||||||
publicMember->expression->firstSourceLocation(),
|
publicMember->statement->firstSourceLocation(),
|
||||||
publicMember->expression->lastSourceLocation());
|
publicMember->statement->lastSourceLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -523,7 +523,7 @@ QModelIndex QmlOutlineModel::enterPublicMember(AST::UiPublicMember *publicMember
|
|||||||
|
|
||||||
if (publicMember->name)
|
if (publicMember->name)
|
||||||
objectData.insert(Qt::DisplayRole, publicMember->name->asString());
|
objectData.insert(Qt::DisplayRole, publicMember->name->asString());
|
||||||
objectData.insert(AnnotationRole, getAnnotation(publicMember->expression));
|
objectData.insert(AnnotationRole, getAnnotation(publicMember->statement));
|
||||||
objectData.insert(ItemTypeRole, NonElementBindingType);
|
objectData.insert(ItemTypeRole, NonElementBindingType);
|
||||||
|
|
||||||
QmlOutlineItem *item = enterNode(objectData, publicMember, 0, m_icons->publicMemberIcon());
|
QmlOutlineItem *item = enterNode(objectData, publicMember, 0, m_icons->publicMemberIcon());
|
||||||
|
Reference in New Issue
Block a user