forked from qt-creator/qt-creator
Renamed classes and files to use the QmlJS prefix.
This commit is contained in:
@@ -47,13 +47,13 @@
|
||||
# define QT_QML_BEGIN_NAMESPACE
|
||||
# define QT_QML_END_NAMESPACE
|
||||
|
||||
# ifdef QML_BUILD_LIB
|
||||
# ifdef QMLJS_BUILD_DIR
|
||||
# define QML_PARSER_EXPORT Q_DECL_EXPORT
|
||||
# elif QML_BUILD_STATIC_LIB
|
||||
# define QML_PARSER_EXPORT
|
||||
# else
|
||||
# define QML_PARSER_EXPORT Q_DECL_IMPORT
|
||||
# endif // QML_BUILD_LIB
|
||||
# endif // QMLJS_BUILD_DIR
|
||||
|
||||
#else // !QT_CREATOR
|
||||
# define QT_QML_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
contains(CONFIG, dll) {
|
||||
DEFINES += QML_BUILD_LIB
|
||||
DEFINES += QMLJS_BUILD_DIR
|
||||
} else {
|
||||
DEFINES += QML_BUILD_STATIC_LIB
|
||||
}
|
||||
@@ -12,23 +12,27 @@ DEPENDPATH += $$PWD
|
||||
INCLUDEPATH += $$PWD/..
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/qml_global.h \
|
||||
$$PWD/qmlidcollector.h \
|
||||
$$PWD/qmldocument.h \
|
||||
$$PWD/qmlpackageinfo.h \
|
||||
$$PWD/qmlsymbol.h \
|
||||
$$PWD/qmlmetatypebackend.h \
|
||||
$$PWD/qmltypesystem.h \
|
||||
$$PWD/qscriptincrementalscanner.h
|
||||
$$PWD/qmljs_global.h \
|
||||
$$PWD/qmljsbind.h \
|
||||
$$PWD/qmljscheck.h \
|
||||
$$PWD/qmljsdocument.h \
|
||||
$$PWD/qmljsidcollector.h \
|
||||
$$PWD/qmljsmetatypebackend.h \
|
||||
$$PWD/qmljspackageinfo.h \
|
||||
$$PWD/qmljsscanner.h \
|
||||
$$PWD/qmljssymbol.h \
|
||||
$$PWD/qmljstypesystem.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/qmlidcollector.cpp \
|
||||
$$PWD/qmldocument.cpp \
|
||||
$$PWD/qmlsymbol.cpp \
|
||||
$$PWD/qmlpackageinfo.cpp \
|
||||
$$PWD/qmlmetatypebackend.cpp \
|
||||
$$PWD/qmltypesystem.cpp \
|
||||
$$PWD/qscriptincrementalscanner.cpp
|
||||
$$PWD/qmljsbind.cpp \
|
||||
$$PWD/qmljscheck.cpp \
|
||||
$$PWD/qmljsdocument.cpp \
|
||||
$$PWD/qmljsidcollector.cpp \
|
||||
$$PWD/qmljsmetatypebackend.cpp \
|
||||
$$PWD/qmljspackageinfo.cpp \
|
||||
$$PWD/qmljsscanner.cpp \
|
||||
$$PWD/qmljssymbol.cpp \
|
||||
$$PWD/qmljstypesystem.cpp
|
||||
|
||||
contains(QT_CONFIG, declarative) {
|
||||
QT += declarative
|
||||
@@ -43,6 +47,6 @@ contains(QT_CONFIG, declarative) {
|
||||
}
|
||||
|
||||
contains(QT, gui) {
|
||||
SOURCES += $$PWD/qscripthighlighter.cpp $$PWD/qscriptindenter.cpp
|
||||
HEADERS += $$PWD/qscripthighlighter.h $$PWD/qscriptindenter.h
|
||||
SOURCES += $$PWD/qmljshighlighter.cpp $$PWD/qmljsindenter.cpp
|
||||
HEADERS += $$PWD/qmljshighlighter.h $$PWD/qmljsindenter.h
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
TEMPLATE = lib
|
||||
CONFIG += dll
|
||||
TARGET = QmlJS
|
||||
DEFINES += QML_BUILD_LIB QT_CREATOR
|
||||
DEFINES += QMLJS_BUILD_DIR QT_CREATOR
|
||||
|
||||
unix:QMAKE_CXXFLAGS_DEBUG += -O3
|
||||
|
||||
|
||||
@@ -27,17 +27,17 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef QML_GLOBAL_H
|
||||
#define QML_GLOBAL_H
|
||||
#ifndef QMLJS_GLOBAL_H
|
||||
#define QMLJS_GLOBAL_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if defined(QML_BUILD_LIB)
|
||||
# define QML_EXPORT Q_DECL_EXPORT
|
||||
#if defined(QMLJS_BUILD_DIR)
|
||||
# define QMLJS_EXPORT Q_DECL_EXPORT
|
||||
#elif defined(QML_BUILD_STATIC_LIB)
|
||||
# define QML_EXPORT
|
||||
# define QMLJS_EXPORT
|
||||
#else
|
||||
# define QML_EXPORT Q_DECL_IMPORT
|
||||
# define QMLJS_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif // QML_GLOBAL_H
|
||||
#endif // QMLJS_GLOBAL_H
|
||||
501
src/libs/qmljs/qmljsbind.cpp
Normal file
501
src/libs/qmljs/qmljsbind.cpp
Normal file
@@ -0,0 +1,501 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "qmljsbind.h"
|
||||
#include "parser/qmljsast_p.h"
|
||||
|
||||
using namespace QmlJS;
|
||||
|
||||
Bind::Bind()
|
||||
{
|
||||
}
|
||||
|
||||
Bind::~Bind()
|
||||
{
|
||||
}
|
||||
|
||||
void Bind::operator()(Document::Ptr doc)
|
||||
{
|
||||
_doc = doc;
|
||||
}
|
||||
|
||||
void Bind::accept(AST::Node *node)
|
||||
{
|
||||
AST::Node::accept(node, this);
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UiProgram *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UiImportList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UiImport *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UiPublicMember *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UiSourceElement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UiObjectDefinition *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UiObjectInitializer *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UiObjectBinding *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UiScriptBinding *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UiArrayBinding *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UiObjectMemberList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UiArrayMemberList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UiQualifiedId *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UiSignature *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UiFormalList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UiFormal *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::ThisExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::IdentifierExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::NullExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::TrueLiteral *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::FalseLiteral *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::StringLiteral *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::NumericLiteral *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::RegExpLiteral *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::ArrayLiteral *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::ObjectLiteral *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::ElementList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::Elision *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::PropertyNameAndValueList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::NestedExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::IdentifierPropertyName *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::StringLiteralPropertyName *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::NumericLiteralPropertyName *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::ArrayMemberExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::FieldMemberExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::NewMemberExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::NewExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::CallExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::ArgumentList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::PostIncrementExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::PostDecrementExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::DeleteExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::VoidExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::TypeOfExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::PreIncrementExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::PreDecrementExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UnaryPlusExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::UnaryMinusExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::TildeExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::NotExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::BinaryExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::ConditionalExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::Expression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::Block *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::StatementList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::VariableStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::VariableDeclarationList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::VariableDeclaration *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::EmptyStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::ExpressionStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::IfStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::DoWhileStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::WhileStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::ForStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::LocalForStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::ForEachStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::LocalForEachStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::ContinueStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::BreakStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::ReturnStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::WithStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::SwitchStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::CaseBlock *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::CaseClauses *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::CaseClause *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::DefaultClause *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::LabelledStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::ThrowStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::TryStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::Catch *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::Finally *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::FunctionDeclaration *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::FunctionExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::FormalParameterList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::FunctionBody *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::Program *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::SourceElements *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::FunctionSourceElement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::StatementSourceElement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bind::visit(AST::DebuggerStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
149
src/libs/qmljs/qmljsbind.h
Normal file
149
src/libs/qmljs/qmljsbind.h
Normal file
@@ -0,0 +1,149 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef QMLBIND_H
|
||||
#define QMLBIND_H
|
||||
|
||||
#include "parser/qmljsastvisitor_p.h"
|
||||
#include "qmljsdocument.h"
|
||||
|
||||
namespace QmlJS {
|
||||
|
||||
class QMLJS_EXPORT Bind: protected AST::Visitor
|
||||
{
|
||||
public:
|
||||
Bind();
|
||||
virtual ~Bind();
|
||||
|
||||
void operator()(QmlJS::Document::Ptr doc);
|
||||
|
||||
protected:
|
||||
void accept(AST::Node *node);
|
||||
|
||||
// Ui
|
||||
virtual bool visit(AST::UiProgram *ast);
|
||||
virtual bool visit(AST::UiImportList *ast);
|
||||
virtual bool visit(AST::UiImport *ast);
|
||||
virtual bool visit(AST::UiPublicMember *ast);
|
||||
virtual bool visit(AST::UiSourceElement *ast);
|
||||
virtual bool visit(AST::UiObjectDefinition *ast);
|
||||
virtual bool visit(AST::UiObjectInitializer *ast);
|
||||
virtual bool visit(AST::UiObjectBinding *ast);
|
||||
virtual bool visit(AST::UiScriptBinding *ast);
|
||||
virtual bool visit(AST::UiArrayBinding *ast);
|
||||
virtual bool visit(AST::UiObjectMemberList *ast);
|
||||
virtual bool visit(AST::UiArrayMemberList *ast);
|
||||
virtual bool visit(AST::UiQualifiedId *ast);
|
||||
virtual bool visit(AST::UiSignature *ast);
|
||||
virtual bool visit(AST::UiFormalList *ast);
|
||||
virtual bool visit(AST::UiFormal *ast);
|
||||
|
||||
// QmlJS
|
||||
virtual bool visit(AST::ThisExpression *ast);
|
||||
virtual bool visit(AST::IdentifierExpression *ast);
|
||||
virtual bool visit(AST::NullExpression *ast);
|
||||
virtual bool visit(AST::TrueLiteral *ast);
|
||||
virtual bool visit(AST::FalseLiteral *ast);
|
||||
virtual bool visit(AST::StringLiteral *ast);
|
||||
virtual bool visit(AST::NumericLiteral *ast);
|
||||
virtual bool visit(AST::RegExpLiteral *ast);
|
||||
virtual bool visit(AST::ArrayLiteral *ast);
|
||||
virtual bool visit(AST::ObjectLiteral *ast);
|
||||
virtual bool visit(AST::ElementList *ast);
|
||||
virtual bool visit(AST::Elision *ast);
|
||||
virtual bool visit(AST::PropertyNameAndValueList *ast);
|
||||
virtual bool visit(AST::NestedExpression *ast);
|
||||
virtual bool visit(AST::IdentifierPropertyName *ast);
|
||||
virtual bool visit(AST::StringLiteralPropertyName *ast);
|
||||
virtual bool visit(AST::NumericLiteralPropertyName *ast);
|
||||
virtual bool visit(AST::ArrayMemberExpression *ast);
|
||||
virtual bool visit(AST::FieldMemberExpression *ast);
|
||||
virtual bool visit(AST::NewMemberExpression *ast);
|
||||
virtual bool visit(AST::NewExpression *ast);
|
||||
virtual bool visit(AST::CallExpression *ast);
|
||||
virtual bool visit(AST::ArgumentList *ast);
|
||||
virtual bool visit(AST::PostIncrementExpression *ast);
|
||||
virtual bool visit(AST::PostDecrementExpression *ast);
|
||||
virtual bool visit(AST::DeleteExpression *ast);
|
||||
virtual bool visit(AST::VoidExpression *ast);
|
||||
virtual bool visit(AST::TypeOfExpression *ast);
|
||||
virtual bool visit(AST::PreIncrementExpression *ast);
|
||||
virtual bool visit(AST::PreDecrementExpression *ast);
|
||||
virtual bool visit(AST::UnaryPlusExpression *ast);
|
||||
virtual bool visit(AST::UnaryMinusExpression *ast);
|
||||
virtual bool visit(AST::TildeExpression *ast);
|
||||
virtual bool visit(AST::NotExpression *ast);
|
||||
virtual bool visit(AST::BinaryExpression *ast);
|
||||
virtual bool visit(AST::ConditionalExpression *ast);
|
||||
virtual bool visit(AST::Expression *ast);
|
||||
virtual bool visit(AST::Block *ast);
|
||||
virtual bool visit(AST::StatementList *ast);
|
||||
virtual bool visit(AST::VariableStatement *ast);
|
||||
virtual bool visit(AST::VariableDeclarationList *ast);
|
||||
virtual bool visit(AST::VariableDeclaration *ast);
|
||||
virtual bool visit(AST::EmptyStatement *ast);
|
||||
virtual bool visit(AST::ExpressionStatement *ast);
|
||||
virtual bool visit(AST::IfStatement *ast);
|
||||
virtual bool visit(AST::DoWhileStatement *ast);
|
||||
virtual bool visit(AST::WhileStatement *ast);
|
||||
virtual bool visit(AST::ForStatement *ast);
|
||||
virtual bool visit(AST::LocalForStatement *ast);
|
||||
virtual bool visit(AST::ForEachStatement *ast);
|
||||
virtual bool visit(AST::LocalForEachStatement *ast);
|
||||
virtual bool visit(AST::ContinueStatement *ast);
|
||||
virtual bool visit(AST::BreakStatement *ast);
|
||||
virtual bool visit(AST::ReturnStatement *ast);
|
||||
virtual bool visit(AST::WithStatement *ast);
|
||||
virtual bool visit(AST::SwitchStatement *ast);
|
||||
virtual bool visit(AST::CaseBlock *ast);
|
||||
virtual bool visit(AST::CaseClauses *ast);
|
||||
virtual bool visit(AST::CaseClause *ast);
|
||||
virtual bool visit(AST::DefaultClause *ast);
|
||||
virtual bool visit(AST::LabelledStatement *ast);
|
||||
virtual bool visit(AST::ThrowStatement *ast);
|
||||
virtual bool visit(AST::TryStatement *ast);
|
||||
virtual bool visit(AST::Catch *ast);
|
||||
virtual bool visit(AST::Finally *ast);
|
||||
virtual bool visit(AST::FunctionDeclaration *ast);
|
||||
virtual bool visit(AST::FunctionExpression *ast);
|
||||
virtual bool visit(AST::FormalParameterList *ast);
|
||||
virtual bool visit(AST::FunctionBody *ast);
|
||||
virtual bool visit(AST::Program *ast);
|
||||
virtual bool visit(AST::SourceElements *ast);
|
||||
virtual bool visit(AST::FunctionSourceElement *ast);
|
||||
virtual bool visit(AST::StatementSourceElement *ast);
|
||||
virtual bool visit(AST::DebuggerStatement *ast);
|
||||
|
||||
private:
|
||||
QmlJS::Document::Ptr _doc;
|
||||
};
|
||||
|
||||
} // end of namespace Qml
|
||||
|
||||
#endif // QMLBIND_H
|
||||
501
src/libs/qmljs/qmljscheck.cpp
Normal file
501
src/libs/qmljs/qmljscheck.cpp
Normal file
@@ -0,0 +1,501 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "qmljscheck.h"
|
||||
#include "parser/qmljsast_p.h"
|
||||
|
||||
using namespace QmlJS;
|
||||
|
||||
Check::Check()
|
||||
{
|
||||
}
|
||||
|
||||
Check::~Check()
|
||||
{
|
||||
}
|
||||
|
||||
void Check::operator()(Document::Ptr doc)
|
||||
{
|
||||
_doc = doc;
|
||||
}
|
||||
|
||||
void Check::accept(AST::Node *node)
|
||||
{
|
||||
AST::Node::accept(node, this);
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UiProgram *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UiImportList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UiImport *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UiPublicMember *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UiSourceElement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UiObjectDefinition *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UiObjectInitializer *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UiObjectBinding *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UiScriptBinding *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UiArrayBinding *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UiObjectMemberList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UiArrayMemberList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UiQualifiedId *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UiSignature *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UiFormalList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UiFormal *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::ThisExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::IdentifierExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::NullExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::TrueLiteral *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::FalseLiteral *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::StringLiteral *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::NumericLiteral *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::RegExpLiteral *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::ArrayLiteral *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::ObjectLiteral *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::ElementList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::Elision *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::PropertyNameAndValueList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::NestedExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::IdentifierPropertyName *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::StringLiteralPropertyName *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::NumericLiteralPropertyName *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::ArrayMemberExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::FieldMemberExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::NewMemberExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::NewExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::CallExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::ArgumentList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::PostIncrementExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::PostDecrementExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::DeleteExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::VoidExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::TypeOfExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::PreIncrementExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::PreDecrementExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UnaryPlusExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::UnaryMinusExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::TildeExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::NotExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::BinaryExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::ConditionalExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::Expression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::Block *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::StatementList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::VariableStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::VariableDeclarationList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::VariableDeclaration *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::EmptyStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::ExpressionStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::IfStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::DoWhileStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::WhileStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::ForStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::LocalForStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::ForEachStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::LocalForEachStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::ContinueStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::BreakStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::ReturnStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::WithStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::SwitchStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::CaseBlock *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::CaseClauses *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::CaseClause *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::DefaultClause *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::LabelledStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::ThrowStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::TryStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::Catch *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::Finally *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::FunctionDeclaration *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::FunctionExpression *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::FormalParameterList *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::FunctionBody *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::Program *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::SourceElements *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::FunctionSourceElement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::StatementSourceElement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Check::visit(AST::DebuggerStatement *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
149
src/libs/qmljs/qmljscheck.h
Normal file
149
src/libs/qmljs/qmljscheck.h
Normal file
@@ -0,0 +1,149 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef QMLCHECK_H
|
||||
#define QMLCHECK_H
|
||||
|
||||
#include "parser/qmljsastvisitor_p.h"
|
||||
#include "qmljsdocument.h"
|
||||
|
||||
namespace QmlJS {
|
||||
|
||||
class QMLJS_EXPORT Check: protected AST::Visitor
|
||||
{
|
||||
public:
|
||||
Check();
|
||||
virtual ~Check();
|
||||
|
||||
void operator()(QmlJS::Document::Ptr doc);
|
||||
|
||||
protected:
|
||||
void accept(AST::Node *node);
|
||||
|
||||
// Ui
|
||||
virtual bool visit(AST::UiProgram *ast);
|
||||
virtual bool visit(AST::UiImportList *ast);
|
||||
virtual bool visit(AST::UiImport *ast);
|
||||
virtual bool visit(AST::UiPublicMember *ast);
|
||||
virtual bool visit(AST::UiSourceElement *ast);
|
||||
virtual bool visit(AST::UiObjectDefinition *ast);
|
||||
virtual bool visit(AST::UiObjectInitializer *ast);
|
||||
virtual bool visit(AST::UiObjectBinding *ast);
|
||||
virtual bool visit(AST::UiScriptBinding *ast);
|
||||
virtual bool visit(AST::UiArrayBinding *ast);
|
||||
virtual bool visit(AST::UiObjectMemberList *ast);
|
||||
virtual bool visit(AST::UiArrayMemberList *ast);
|
||||
virtual bool visit(AST::UiQualifiedId *ast);
|
||||
virtual bool visit(AST::UiSignature *ast);
|
||||
virtual bool visit(AST::UiFormalList *ast);
|
||||
virtual bool visit(AST::UiFormal *ast);
|
||||
|
||||
// QmlJS
|
||||
virtual bool visit(AST::ThisExpression *ast);
|
||||
virtual bool visit(AST::IdentifierExpression *ast);
|
||||
virtual bool visit(AST::NullExpression *ast);
|
||||
virtual bool visit(AST::TrueLiteral *ast);
|
||||
virtual bool visit(AST::FalseLiteral *ast);
|
||||
virtual bool visit(AST::StringLiteral *ast);
|
||||
virtual bool visit(AST::NumericLiteral *ast);
|
||||
virtual bool visit(AST::RegExpLiteral *ast);
|
||||
virtual bool visit(AST::ArrayLiteral *ast);
|
||||
virtual bool visit(AST::ObjectLiteral *ast);
|
||||
virtual bool visit(AST::ElementList *ast);
|
||||
virtual bool visit(AST::Elision *ast);
|
||||
virtual bool visit(AST::PropertyNameAndValueList *ast);
|
||||
virtual bool visit(AST::NestedExpression *ast);
|
||||
virtual bool visit(AST::IdentifierPropertyName *ast);
|
||||
virtual bool visit(AST::StringLiteralPropertyName *ast);
|
||||
virtual bool visit(AST::NumericLiteralPropertyName *ast);
|
||||
virtual bool visit(AST::ArrayMemberExpression *ast);
|
||||
virtual bool visit(AST::FieldMemberExpression *ast);
|
||||
virtual bool visit(AST::NewMemberExpression *ast);
|
||||
virtual bool visit(AST::NewExpression *ast);
|
||||
virtual bool visit(AST::CallExpression *ast);
|
||||
virtual bool visit(AST::ArgumentList *ast);
|
||||
virtual bool visit(AST::PostIncrementExpression *ast);
|
||||
virtual bool visit(AST::PostDecrementExpression *ast);
|
||||
virtual bool visit(AST::DeleteExpression *ast);
|
||||
virtual bool visit(AST::VoidExpression *ast);
|
||||
virtual bool visit(AST::TypeOfExpression *ast);
|
||||
virtual bool visit(AST::PreIncrementExpression *ast);
|
||||
virtual bool visit(AST::PreDecrementExpression *ast);
|
||||
virtual bool visit(AST::UnaryPlusExpression *ast);
|
||||
virtual bool visit(AST::UnaryMinusExpression *ast);
|
||||
virtual bool visit(AST::TildeExpression *ast);
|
||||
virtual bool visit(AST::NotExpression *ast);
|
||||
virtual bool visit(AST::BinaryExpression *ast);
|
||||
virtual bool visit(AST::ConditionalExpression *ast);
|
||||
virtual bool visit(AST::Expression *ast);
|
||||
virtual bool visit(AST::Block *ast);
|
||||
virtual bool visit(AST::StatementList *ast);
|
||||
virtual bool visit(AST::VariableStatement *ast);
|
||||
virtual bool visit(AST::VariableDeclarationList *ast);
|
||||
virtual bool visit(AST::VariableDeclaration *ast);
|
||||
virtual bool visit(AST::EmptyStatement *ast);
|
||||
virtual bool visit(AST::ExpressionStatement *ast);
|
||||
virtual bool visit(AST::IfStatement *ast);
|
||||
virtual bool visit(AST::DoWhileStatement *ast);
|
||||
virtual bool visit(AST::WhileStatement *ast);
|
||||
virtual bool visit(AST::ForStatement *ast);
|
||||
virtual bool visit(AST::LocalForStatement *ast);
|
||||
virtual bool visit(AST::ForEachStatement *ast);
|
||||
virtual bool visit(AST::LocalForEachStatement *ast);
|
||||
virtual bool visit(AST::ContinueStatement *ast);
|
||||
virtual bool visit(AST::BreakStatement *ast);
|
||||
virtual bool visit(AST::ReturnStatement *ast);
|
||||
virtual bool visit(AST::WithStatement *ast);
|
||||
virtual bool visit(AST::SwitchStatement *ast);
|
||||
virtual bool visit(AST::CaseBlock *ast);
|
||||
virtual bool visit(AST::CaseClauses *ast);
|
||||
virtual bool visit(AST::CaseClause *ast);
|
||||
virtual bool visit(AST::DefaultClause *ast);
|
||||
virtual bool visit(AST::LabelledStatement *ast);
|
||||
virtual bool visit(AST::ThrowStatement *ast);
|
||||
virtual bool visit(AST::TryStatement *ast);
|
||||
virtual bool visit(AST::Catch *ast);
|
||||
virtual bool visit(AST::Finally *ast);
|
||||
virtual bool visit(AST::FunctionDeclaration *ast);
|
||||
virtual bool visit(AST::FunctionExpression *ast);
|
||||
virtual bool visit(AST::FormalParameterList *ast);
|
||||
virtual bool visit(AST::FunctionBody *ast);
|
||||
virtual bool visit(AST::Program *ast);
|
||||
virtual bool visit(AST::SourceElements *ast);
|
||||
virtual bool visit(AST::FunctionSourceElement *ast);
|
||||
virtual bool visit(AST::StatementSourceElement *ast);
|
||||
virtual bool visit(AST::DebuggerStatement *ast);
|
||||
|
||||
private:
|
||||
QmlJS::Document::Ptr _doc;
|
||||
};
|
||||
|
||||
} // end of namespace Qml
|
||||
|
||||
#endif // QMLCheck_H
|
||||
@@ -27,19 +27,19 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "qmlidcollector.h"
|
||||
#include "qmldocument.h"
|
||||
#include "qmljsidcollector.h"
|
||||
#include "qmljsdocument.h"
|
||||
#include <qmljs/parser/qmljsast_p.h>
|
||||
#include <qmljs/parser/qmljslexer_p.h>
|
||||
#include <qmljs/parser/qmljsparser_p.h>
|
||||
#include <qmljs/parser/qmljsnodepool_p.h>
|
||||
#include <qmljs/parser/qmljsastfwd_p.h>
|
||||
|
||||
using namespace Qml;
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::AST;
|
||||
|
||||
QmlDocument::QmlDocument(const QString &fileName)
|
||||
Document::Document(const QString &fileName)
|
||||
: _engine(0)
|
||||
, _pool(0)
|
||||
, _uiProgram(0)
|
||||
@@ -55,7 +55,7 @@ QmlDocument::QmlDocument(const QString &fileName)
|
||||
_componentName = fileName.mid(slashIdx + 1, fileName.size() - (slashIdx + 1) - 4);
|
||||
}
|
||||
|
||||
QmlDocument::~QmlDocument()
|
||||
Document::~Document()
|
||||
{
|
||||
if (_engine)
|
||||
delete _engine;
|
||||
@@ -66,38 +66,38 @@ QmlDocument::~QmlDocument()
|
||||
qDeleteAll(_symbols);
|
||||
}
|
||||
|
||||
QmlDocument::Ptr QmlDocument::create(const QString &fileName)
|
||||
Document::Ptr Document::create(const QString &fileName)
|
||||
{
|
||||
QmlDocument::Ptr doc(new QmlDocument(fileName));
|
||||
Document::Ptr doc(new Document(fileName));
|
||||
return doc;
|
||||
}
|
||||
|
||||
AST::UiProgram *QmlDocument::qmlProgram() const
|
||||
AST::UiProgram *Document::qmlProgram() const
|
||||
{
|
||||
return _uiProgram;
|
||||
}
|
||||
|
||||
AST::Program *QmlDocument::jsProgram() const
|
||||
AST::Program *Document::jsProgram() const
|
||||
{
|
||||
return _jsProgram;
|
||||
}
|
||||
|
||||
QList<DiagnosticMessage> QmlDocument::diagnosticMessages() const
|
||||
QList<DiagnosticMessage> Document::diagnosticMessages() const
|
||||
{
|
||||
return _diagnosticMessages;
|
||||
}
|
||||
|
||||
QString QmlDocument::source() const
|
||||
QString Document::source() const
|
||||
{
|
||||
return _source;
|
||||
}
|
||||
|
||||
void QmlDocument::setSource(const QString &source)
|
||||
void Document::setSource(const QString &source)
|
||||
{
|
||||
_source = source;
|
||||
}
|
||||
|
||||
bool QmlDocument::parseQml()
|
||||
bool Document::parseQml()
|
||||
{
|
||||
Q_ASSERT(! _engine);
|
||||
Q_ASSERT(! _pool);
|
||||
@@ -120,9 +120,9 @@ bool QmlDocument::parseQml()
|
||||
if (_uiProgram) {
|
||||
for (QmlJS::AST::UiObjectMemberList *iter = _uiProgram->members; iter; iter = iter->next)
|
||||
if (iter->member)
|
||||
_symbols.append(new QmlSymbolFromFile(_fileName, iter->member));
|
||||
_symbols.append(new SymbolFromFile(_fileName, iter->member));
|
||||
|
||||
Internal::QmlIdCollector collect;
|
||||
Internal::IdCollector collect;
|
||||
_ids = collect(*this);
|
||||
if (_diagnosticMessages.isEmpty())
|
||||
_diagnosticMessages = collect.diagnosticMessages();
|
||||
@@ -131,7 +131,7 @@ bool QmlDocument::parseQml()
|
||||
return _parsedCorrectly;
|
||||
}
|
||||
|
||||
bool QmlDocument::parseJavaScript()
|
||||
bool Document::parseJavaScript()
|
||||
{
|
||||
Q_ASSERT(! _engine);
|
||||
Q_ASSERT(! _pool);
|
||||
@@ -154,9 +154,9 @@ bool QmlDocument::parseJavaScript()
|
||||
return _parsedCorrectly;
|
||||
}
|
||||
|
||||
QmlSymbolFromFile *QmlDocument::findSymbol(QmlJS::AST::Node *node) const
|
||||
SymbolFromFile *Document::findSymbol(QmlJS::AST::Node *node) const
|
||||
{
|
||||
foreach (QmlSymbol *symbol, _symbols)
|
||||
foreach (Symbol *symbol, _symbols)
|
||||
if (symbol->isSymbolFromFile())
|
||||
if (symbol->asSymbolFromFile()->node() == node)
|
||||
return symbol->asSymbolFromFile();
|
||||
@@ -172,19 +172,19 @@ Snapshot::~Snapshot()
|
||||
{
|
||||
}
|
||||
|
||||
void Snapshot::insert(const QmlDocument::Ptr &document)
|
||||
void Snapshot::insert(const Document::Ptr &document)
|
||||
{
|
||||
if (document && (document->qmlProgram() || document->jsProgram()))
|
||||
QMap<QString, QmlDocument::Ptr>::insert(document->fileName(), document);
|
||||
QMap<QString, Document::Ptr>::insert(document->fileName(), document);
|
||||
}
|
||||
|
||||
QmlDocument::PtrList Snapshot::importedDocuments(const QmlDocument::Ptr &doc, const QString &importPath) const
|
||||
Document::PtrList Snapshot::importedDocuments(const Document::Ptr &doc, const QString &importPath) const
|
||||
{
|
||||
QmlDocument::PtrList result;
|
||||
Document::PtrList result;
|
||||
|
||||
const QString docPath = doc->path() + '/' + importPath;
|
||||
|
||||
foreach (QmlDocument::Ptr candidate, *this) {
|
||||
foreach (Document::Ptr candidate, *this) {
|
||||
if (candidate == doc)
|
||||
continue;
|
||||
|
||||
@@ -195,13 +195,13 @@ QmlDocument::PtrList Snapshot::importedDocuments(const QmlDocument::Ptr &doc, co
|
||||
return result;
|
||||
}
|
||||
|
||||
QMap<QString, QmlDocument::Ptr> Snapshot::componentsDefinedByImportedDocuments(const QmlDocument::Ptr &doc, const QString &importPath) const
|
||||
QMap<QString, Document::Ptr> Snapshot::componentsDefinedByImportedDocuments(const Document::Ptr &doc, const QString &importPath) const
|
||||
{
|
||||
QMap<QString, QmlDocument::Ptr> result;
|
||||
QMap<QString, Document::Ptr> result;
|
||||
|
||||
const QString docPath = doc->path() + '/' + importPath;
|
||||
|
||||
foreach (QmlDocument::Ptr candidate, *this) {
|
||||
foreach (Document::Ptr candidate, *this) {
|
||||
if (candidate == doc)
|
||||
continue;
|
||||
|
||||
@@ -36,25 +36,25 @@
|
||||
#include <QtCore/QString>
|
||||
|
||||
#include "parser/qmljsengine_p.h"
|
||||
#include "qml_global.h"
|
||||
#include "qmlsymbol.h"
|
||||
#include "qmljs_global.h"
|
||||
#include "qmljssymbol.h"
|
||||
|
||||
namespace Qml {
|
||||
namespace QmlJS {
|
||||
|
||||
class QML_EXPORT QmlDocument
|
||||
class QMLJS_EXPORT Document
|
||||
{
|
||||
public:
|
||||
typedef QSharedPointer<QmlDocument> Ptr;
|
||||
typedef QList<QmlDocument::Ptr> PtrList;
|
||||
typedef QMap<QString, Qml::QmlIdSymbol*> IdTable;
|
||||
typedef QSharedPointer<Document> Ptr;
|
||||
typedef QList<Document::Ptr> PtrList;
|
||||
typedef QMap<QString, IdSymbol*> IdTable;
|
||||
|
||||
protected:
|
||||
QmlDocument(const QString &fileName);
|
||||
Document(const QString &fileName);
|
||||
|
||||
public:
|
||||
~QmlDocument();
|
||||
~Document();
|
||||
|
||||
static QmlDocument::Ptr create(const QString &fileName);
|
||||
static Document::Ptr create(const QString &fileName);
|
||||
|
||||
QmlJS::AST::UiProgram *qmlProgram() const;
|
||||
QmlJS::AST::Program *jsProgram() const;
|
||||
@@ -75,8 +75,8 @@ public:
|
||||
QString path() const { return _path; }
|
||||
QString componentName() const { return _componentName; }
|
||||
|
||||
Qml::QmlSymbolFromFile *findSymbol(QmlJS::AST::Node *node) const;
|
||||
Qml::QmlSymbol::List symbols() const
|
||||
QmlJS::SymbolFromFile *findSymbol(QmlJS::AST::Node *node) const;
|
||||
QmlJS::Symbol::List symbols() const
|
||||
{ return _symbols; }
|
||||
|
||||
private:
|
||||
@@ -91,22 +91,22 @@ private:
|
||||
QString _source;
|
||||
bool _parsedCorrectly;
|
||||
IdTable _ids;
|
||||
Qml::QmlSymbol::List _symbols;
|
||||
QmlJS::Symbol::List _symbols;
|
||||
};
|
||||
|
||||
class QML_EXPORT Snapshot: public QMap<QString, QmlDocument::Ptr>
|
||||
class QMLJS_EXPORT Snapshot: public QMap<QString, Document::Ptr>
|
||||
{
|
||||
public:
|
||||
Snapshot();
|
||||
~Snapshot();
|
||||
|
||||
void insert(const QmlDocument::Ptr &document);
|
||||
void insert(const Document::Ptr &document);
|
||||
|
||||
QmlDocument::Ptr document(const QString &fileName) const
|
||||
Document::Ptr document(const QString &fileName) const
|
||||
{ return value(fileName); }
|
||||
|
||||
QmlDocument::PtrList importedDocuments(const QmlDocument::Ptr &doc, const QString &importPath) const;
|
||||
QMap<QString, QmlDocument::Ptr> componentsDefinedByImportedDocuments(const QmlDocument::Ptr &doc, const QString &importPath) const;
|
||||
Document::PtrList importedDocuments(const Document::Ptr &doc, const QString &importPath) const;
|
||||
QMap<QString, Document::Ptr> componentsDefinedByImportedDocuments(const Document::Ptr &doc, const QString &importPath) const;
|
||||
};
|
||||
|
||||
} // end of namespace Qml
|
||||
@@ -27,7 +27,7 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include <qmljs/qscripthighlighter.h>
|
||||
#include <qmljs/qmljshighlighter.h>
|
||||
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QtAlgorithms>
|
||||
@@ -62,60 +62,60 @@ void QScriptHighlighter::highlightBlock(const QString &text)
|
||||
|
||||
QTextCharFormat emptyFormat;
|
||||
int lastEnd = 0;
|
||||
const QList<QScriptIncrementalScanner::Token> tokens = m_scanner.tokens();
|
||||
const QList<QmlJSScanner::Token> tokens = m_scanner.tokens();
|
||||
for (int i = 0; i < tokens.size(); ++i) {
|
||||
const QScriptIncrementalScanner::Token token = tokens.at(i);
|
||||
const QmlJSScanner::Token token = tokens.at(i);
|
||||
|
||||
if (token.offset != lastEnd)
|
||||
setFormat(lastEnd, token.offset - lastEnd, m_formats[VisualWhitespace]);
|
||||
|
||||
switch (token.kind) {
|
||||
case QScriptIncrementalScanner::Token::Keyword:
|
||||
case QmlJSScanner::Token::Keyword:
|
||||
setFormat(token.offset, token.length, m_formats[KeywordFormat]);
|
||||
break;
|
||||
|
||||
case QScriptIncrementalScanner::Token::String:
|
||||
case QmlJSScanner::Token::String:
|
||||
highlightWhitespace(token, text, StringFormat);
|
||||
break;
|
||||
|
||||
case QScriptIncrementalScanner::Token::Comment:
|
||||
case QmlJSScanner::Token::Comment:
|
||||
highlightWhitespace(token, text, CommentFormat);
|
||||
break;
|
||||
|
||||
case QScriptIncrementalScanner::Token::Number:
|
||||
case QmlJSScanner::Token::Number:
|
||||
highlightWhitespace(token, text, NumberFormat);
|
||||
break;
|
||||
|
||||
case QScriptIncrementalScanner::Token::LeftParenthesis:
|
||||
case QmlJSScanner::Token::LeftParenthesis:
|
||||
onOpeningParenthesis('(', token.offset);
|
||||
break;
|
||||
|
||||
case QScriptIncrementalScanner::Token::RightParenthesis:
|
||||
case QmlJSScanner::Token::RightParenthesis:
|
||||
onClosingParenthesis(')', token.offset);
|
||||
break;
|
||||
|
||||
case QScriptIncrementalScanner::Token::LeftBrace:
|
||||
case QmlJSScanner::Token::LeftBrace:
|
||||
onOpeningParenthesis('{', token.offset);
|
||||
break;
|
||||
|
||||
case QScriptIncrementalScanner::Token::RightBrace:
|
||||
case QmlJSScanner::Token::RightBrace:
|
||||
onClosingParenthesis('}', token.offset);
|
||||
break;
|
||||
|
||||
case QScriptIncrementalScanner::Token::LeftBracket:
|
||||
case QmlJSScanner::Token::LeftBracket:
|
||||
onOpeningParenthesis('[', token.offset);
|
||||
break;
|
||||
|
||||
case QScriptIncrementalScanner::Token::RightBracket:
|
||||
case QmlJSScanner::Token::RightBracket:
|
||||
onClosingParenthesis(']', token.offset);
|
||||
break;
|
||||
|
||||
case QScriptIncrementalScanner::Token::Identifier:
|
||||
if (m_duiEnabled && (i + 1 != tokens.size()) && tokens.at(i + 1).kind == QScriptIncrementalScanner::Token::Colon) {
|
||||
case QmlJSScanner::Token::Identifier:
|
||||
if (m_duiEnabled && (i + 1 != tokens.size()) && tokens.at(i + 1).kind == QmlJSScanner::Token::Colon) {
|
||||
int j = i;
|
||||
for (; j != -1; --j) {
|
||||
const QScriptIncrementalScanner::Token &tok = tokens.at(j);
|
||||
if (tok.is(QScriptIncrementalScanner::Token::Dot) || tok.is(QScriptIncrementalScanner::Token::Identifier)) {
|
||||
const QmlJSScanner::Token &tok = tokens.at(j);
|
||||
if (tok.is(QmlJSScanner::Token::Dot) || tok.is(QmlJSScanner::Token::Identifier)) {
|
||||
setFormat(tok.offset, tok.length, m_formats[LabelFormat]);
|
||||
} else {
|
||||
break;
|
||||
@@ -131,15 +131,15 @@ void QScriptHighlighter::highlightBlock(const QString &text)
|
||||
}
|
||||
break;
|
||||
|
||||
case QScriptIncrementalScanner::Token::Colon:
|
||||
if (m_duiEnabled && i > 0 && tokens.at(i - 1).kind == QScriptIncrementalScanner::Token::Identifier)
|
||||
case QmlJSScanner::Token::Colon:
|
||||
if (m_duiEnabled && i > 0 && tokens.at(i - 1).kind == QmlJSScanner::Token::Identifier)
|
||||
setFormat(token.offset, token.length, m_formats[LabelFormat]);
|
||||
else
|
||||
setFormat(token.offset, token.length, emptyFormat);
|
||||
break;
|
||||
|
||||
case QScriptIncrementalScanner::Token::Operator:
|
||||
case QScriptIncrementalScanner::Token::Dot:
|
||||
case QmlJSScanner::Token::Operator:
|
||||
case QmlJSScanner::Token::Dot:
|
||||
setFormat(token.offset, token.length, emptyFormat);
|
||||
break;
|
||||
|
||||
@@ -247,7 +247,7 @@ void QScriptHighlighter::onOpeningParenthesis(QChar, int) {}
|
||||
void QScriptHighlighter::onClosingParenthesis(QChar, int) {}
|
||||
void QScriptHighlighter::onBlockEnd(int state, int) { return setCurrentBlockState(state); }
|
||||
|
||||
void QScriptHighlighter::highlightWhitespace(const QScriptIncrementalScanner::Token &token, const QString &text, int nonWhitespaceFormat)
|
||||
void QScriptHighlighter::highlightWhitespace(const QmlJSScanner::Token &token, const QString &text, int nonWhitespaceFormat)
|
||||
{
|
||||
const QTextCharFormat normalFormat = m_formats[nonWhitespaceFormat];
|
||||
const QTextCharFormat visualSpaceFormat = m_formats[VisualWhitespace];
|
||||
@@ -30,7 +30,7 @@
|
||||
#ifndef QSCRIPTSYNTAXHIGHLIGHTER_H
|
||||
#define QSCRIPTSYNTAXHIGHLIGHTER_H
|
||||
|
||||
#include <qmljs/qscriptincrementalscanner.h>
|
||||
#include <qmljs/qmljsscanner.h>
|
||||
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QSet>
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
namespace QmlJS {
|
||||
|
||||
class QML_EXPORT QScriptHighlighter : public QSyntaxHighlighter
|
||||
class QMLJS_EXPORT QScriptHighlighter : public QSyntaxHighlighter
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -69,10 +69,10 @@ protected:
|
||||
// sets the enriched user state, or simply calls setCurrentBlockState(state);
|
||||
virtual void onBlockEnd(int state, int firstNonSpace);
|
||||
|
||||
virtual void highlightWhitespace(const QScriptIncrementalScanner::Token &token, const QString &text, int nonWhitespaceFormat);
|
||||
virtual void highlightWhitespace(const QmlJSScanner::Token &token, const QString &text, int nonWhitespaceFormat);
|
||||
|
||||
protected:
|
||||
QScriptIncrementalScanner m_scanner;
|
||||
QmlJSScanner m_scanner;
|
||||
|
||||
private:
|
||||
bool m_duiEnabled;
|
||||
@@ -31,14 +31,14 @@
|
||||
|
||||
#include <qmljs/parser/qmljsast_p.h>
|
||||
|
||||
#include "qmlidcollector.h"
|
||||
#include "qmljsidcollector.h"
|
||||
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::AST;
|
||||
using namespace Qml;
|
||||
using namespace Qml::Internal;
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::Internal;
|
||||
|
||||
QMap<QString, QmlIdSymbol*> QmlIdCollector::operator()(Qml::QmlDocument &doc)
|
||||
QMap<QString, IdSymbol*> IdCollector::operator()(QmlJS::Document &doc)
|
||||
{
|
||||
_doc = &doc;
|
||||
_ids.clear();
|
||||
@@ -49,31 +49,31 @@ QMap<QString, QmlIdSymbol*> QmlIdCollector::operator()(Qml::QmlDocument &doc)
|
||||
return _ids;
|
||||
}
|
||||
|
||||
bool QmlIdCollector::visit(UiArrayBinding *ast)
|
||||
bool IdCollector::visit(UiArrayBinding *ast)
|
||||
{
|
||||
QmlSymbolFromFile *oldSymbol = switchSymbol(ast);
|
||||
SymbolFromFile *oldSymbol = switchSymbol(ast);
|
||||
Node::accept(ast->members, this);
|
||||
_currentSymbol = oldSymbol;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QmlIdCollector::visit(QmlJS::AST::UiObjectBinding *ast)
|
||||
bool IdCollector::visit(QmlJS::AST::UiObjectBinding *ast)
|
||||
{
|
||||
QmlSymbolFromFile *oldSymbol = switchSymbol(ast);
|
||||
SymbolFromFile *oldSymbol = switchSymbol(ast);
|
||||
Node::accept(ast->initializer, this);
|
||||
_currentSymbol = oldSymbol;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QmlIdCollector::visit(QmlJS::AST::UiObjectDefinition *ast)
|
||||
bool IdCollector::visit(QmlJS::AST::UiObjectDefinition *ast)
|
||||
{
|
||||
QmlSymbolFromFile *oldSymbol = switchSymbol(ast);
|
||||
SymbolFromFile *oldSymbol = switchSymbol(ast);
|
||||
Node::accept(ast->initializer, this);
|
||||
_currentSymbol = oldSymbol;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QmlIdCollector::visit(QmlJS::AST::UiScriptBinding *ast)
|
||||
bool IdCollector::visit(QmlJS::AST::UiScriptBinding *ast)
|
||||
{
|
||||
if (!(ast->qualifiedId->next) && ast->qualifiedId->name->asString() == "id")
|
||||
if (ExpressionStatement *e = cast<ExpressionStatement*>(ast->statement))
|
||||
@@ -84,9 +84,9 @@ bool QmlIdCollector::visit(QmlJS::AST::UiScriptBinding *ast)
|
||||
return false;
|
||||
}
|
||||
|
||||
QmlSymbolFromFile *QmlIdCollector::switchSymbol(QmlJS::AST::UiObjectMember *node)
|
||||
SymbolFromFile *IdCollector::switchSymbol(QmlJS::AST::UiObjectMember *node)
|
||||
{
|
||||
QmlSymbolFromFile *newSymbol = 0;
|
||||
SymbolFromFile *newSymbol = 0;
|
||||
|
||||
if (_currentSymbol == 0) {
|
||||
newSymbol = _doc->findSymbol(node);
|
||||
@@ -94,7 +94,7 @@ QmlSymbolFromFile *QmlIdCollector::switchSymbol(QmlJS::AST::UiObjectMember *node
|
||||
newSymbol = _currentSymbol->findMember(node);
|
||||
}
|
||||
|
||||
QmlSymbolFromFile *oldSymbol = _currentSymbol;
|
||||
SymbolFromFile *oldSymbol = _currentSymbol;
|
||||
|
||||
if (newSymbol) {
|
||||
_currentSymbol = newSymbol;
|
||||
@@ -106,7 +106,7 @@ QmlSymbolFromFile *QmlIdCollector::switchSymbol(QmlJS::AST::UiObjectMember *node
|
||||
return oldSymbol;
|
||||
}
|
||||
|
||||
void QmlIdCollector::addId(const QString &id, QmlJS::AST::UiScriptBinding *ast)
|
||||
void IdCollector::addId(const QString &id, QmlJS::AST::UiScriptBinding *ast)
|
||||
{
|
||||
if (!_currentSymbol)
|
||||
return;
|
||||
@@ -114,8 +114,8 @@ void QmlIdCollector::addId(const QString &id, QmlJS::AST::UiScriptBinding *ast)
|
||||
if (_ids.contains(id)) {
|
||||
_diagnosticMessages.append(DiagnosticMessage(DiagnosticMessage::Warning, ast->statement->firstSourceLocation(), "Duplicate ID"));
|
||||
} else {
|
||||
if (QmlSymbolFromFile *symbol = _currentSymbol->findMember(ast))
|
||||
if (QmlIdSymbol *idSymbol = symbol->asIdSymbol())
|
||||
if (SymbolFromFile *symbol = _currentSymbol->findMember(ast))
|
||||
if (IdSymbol *idSymbol = symbol->asIdSymbol())
|
||||
_ids[id] = idSymbol;
|
||||
}
|
||||
}
|
||||
@@ -32,40 +32,40 @@
|
||||
|
||||
#include <qmljs/parser/qmljsastvisitor_p.h>
|
||||
#include <qmljs/parser/qmljsengine_p.h>
|
||||
#include <qmljs/qmldocument.h>
|
||||
#include <qmljs/qmlsymbol.h>
|
||||
#include <qmljs/qmljsdocument.h>
|
||||
#include <qmljs/qmljssymbol.h>
|
||||
|
||||
#include <QMap>
|
||||
#include <QPair>
|
||||
#include <QStack>
|
||||
#include <QString>
|
||||
|
||||
namespace Qml {
|
||||
namespace QmlJS {
|
||||
namespace Internal {
|
||||
|
||||
class QML_EXPORT QmlIdCollector: protected QmlJS::AST::Visitor
|
||||
class QMLJS_EXPORT IdCollector: protected AST::Visitor
|
||||
{
|
||||
public:
|
||||
QMap<QString, Qml::QmlIdSymbol*> operator()(Qml::QmlDocument &doc);
|
||||
QMap<QString, IdSymbol*> operator()(Document &doc);
|
||||
|
||||
QList<QmlJS::DiagnosticMessage> diagnosticMessages()
|
||||
QList<DiagnosticMessage> diagnosticMessages()
|
||||
{ return _diagnosticMessages; }
|
||||
|
||||
protected:
|
||||
virtual bool visit(QmlJS::AST::UiArrayBinding *ast);
|
||||
virtual bool visit(QmlJS::AST::UiObjectBinding *ast);
|
||||
virtual bool visit(QmlJS::AST::UiObjectDefinition *ast);
|
||||
virtual bool visit(QmlJS::AST::UiScriptBinding *ast);
|
||||
virtual bool visit(AST::UiArrayBinding *ast);
|
||||
virtual bool visit(AST::UiObjectBinding *ast);
|
||||
virtual bool visit(AST::UiObjectDefinition *ast);
|
||||
virtual bool visit(AST::UiScriptBinding *ast);
|
||||
|
||||
private:
|
||||
Qml::QmlSymbolFromFile *switchSymbol(QmlJS::AST::UiObjectMember *node);
|
||||
void addId(const QString &id, QmlJS::AST::UiScriptBinding *ast);
|
||||
SymbolFromFile *switchSymbol(AST::UiObjectMember *node);
|
||||
void addId(const QString &id, AST::UiScriptBinding *ast);
|
||||
|
||||
private:
|
||||
Qml::QmlDocument *_doc;
|
||||
QMap<QString, Qml::QmlIdSymbol*> _ids;
|
||||
Qml::QmlSymbolFromFile *_currentSymbol;
|
||||
QList<QmlJS::DiagnosticMessage> _diagnosticMessages;
|
||||
Document *_doc;
|
||||
QMap<QString, IdSymbol*> _ids;
|
||||
SymbolFromFile *_currentSymbol;
|
||||
QList<DiagnosticMessage> _diagnosticMessages;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
@@ -65,8 +65,8 @@
|
||||
as comments and string literals are removed beforehand.
|
||||
*/
|
||||
|
||||
#include <qmljs/qscriptindenter.h>
|
||||
#include <qmljs/qscriptincrementalscanner.h>
|
||||
#include <qmljs/qmljsindenter.h>
|
||||
#include <qmljs/qmljsscanner.h>
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
@@ -80,10 +80,10 @@ using namespace QmlJS;
|
||||
For example, the indenter never considers more than BigRoof lines
|
||||
backwards when looking for the start of a C-style comment.
|
||||
*/
|
||||
const int QScriptIndenter::SmallRoof = 40;
|
||||
const int QScriptIndenter::BigRoof = 400;
|
||||
const int QmlJSIndenter::SmallRoof = 40;
|
||||
const int QmlJSIndenter::BigRoof = 400;
|
||||
|
||||
QScriptIndenter::QScriptIndenter()
|
||||
QmlJSIndenter::QmlJSIndenter()
|
||||
: label(QRegExp(QLatin1String("^\\s*((?:case\\b([^:])+|[a-zA-Z_0-9.]+)(?:\\s+)?:)(?!:)"))),
|
||||
braceX(QRegExp(QLatin1String("^\\s*\\}\\s*(?:else|catch)\\b"))),
|
||||
iflikeKeyword(QRegExp(QLatin1String("\\b(?:catch|do|for|if|while|with)\\b")))
|
||||
@@ -121,16 +121,16 @@ QScriptIndenter::QScriptIndenter()
|
||||
yyLeftBraceFollows = 0;
|
||||
}
|
||||
|
||||
QScriptIndenter::~QScriptIndenter()
|
||||
QmlJSIndenter::~QmlJSIndenter()
|
||||
{
|
||||
}
|
||||
|
||||
void QScriptIndenter::setTabSize(int size)
|
||||
void QmlJSIndenter::setTabSize(int size)
|
||||
{
|
||||
ppHardwareTabSize = size;
|
||||
}
|
||||
|
||||
void QScriptIndenter::setIndentSize(int size)
|
||||
void QmlJSIndenter::setIndentSize(int size)
|
||||
{
|
||||
ppIndentSize = size;
|
||||
ppContinuationIndentSize = 2 * size;
|
||||
@@ -140,7 +140,7 @@ void QScriptIndenter::setIndentSize(int size)
|
||||
Returns the first non-space character in the string t, or
|
||||
QChar() if the string is made only of white space.
|
||||
*/
|
||||
QChar QScriptIndenter::firstNonWhiteSpace(const QString &t) const
|
||||
QChar QmlJSIndenter::firstNonWhiteSpace(const QString &t) const
|
||||
{
|
||||
int i = 0;
|
||||
while (i < t.length()) {
|
||||
@@ -155,7 +155,7 @@ QChar QScriptIndenter::firstNonWhiteSpace(const QString &t) const
|
||||
Returns true if string t is made only of white space; otherwise
|
||||
returns false.
|
||||
*/
|
||||
bool QScriptIndenter::isOnlyWhiteSpace(const QString &t) const
|
||||
bool QmlJSIndenter::isOnlyWhiteSpace(const QString &t) const
|
||||
{
|
||||
return firstNonWhiteSpace(t).isNull();
|
||||
}
|
||||
@@ -165,7 +165,7 @@ bool QScriptIndenter::isOnlyWhiteSpace(const QString &t) const
|
||||
index. Column numbers and index are identical for strings that don't
|
||||
contain '\t's.
|
||||
*/
|
||||
int QScriptIndenter::columnForIndex(const QString &t, int index) const
|
||||
int QmlJSIndenter::columnForIndex(const QString &t, int index) const
|
||||
{
|
||||
int col = 0;
|
||||
if (index > t.length())
|
||||
@@ -184,7 +184,7 @@ int QScriptIndenter::columnForIndex(const QString &t, int index) const
|
||||
/*
|
||||
Returns the indentation size of string t.
|
||||
*/
|
||||
int QScriptIndenter::indentOfLine(const QString &t) const
|
||||
int QmlJSIndenter::indentOfLine(const QString &t) const
|
||||
{
|
||||
return columnForIndex(t, t.indexOf(firstNonWhiteSpace(t)));
|
||||
}
|
||||
@@ -195,7 +195,7 @@ int QScriptIndenter::indentOfLine(const QString &t) const
|
||||
provisions are taken against '\n' or '\r', which shouldn't occur in
|
||||
t anyway.
|
||||
*/
|
||||
void QScriptIndenter::eraseChar(QString &t, int k, QChar ch) const
|
||||
void QmlJSIndenter::eraseChar(QString &t, int k, QChar ch) const
|
||||
{
|
||||
if (t.at(k) != QLatin1Char('\t'))
|
||||
t[k] = ch;
|
||||
@@ -205,9 +205,9 @@ void QScriptIndenter::eraseChar(QString &t, int k, QChar ch) const
|
||||
Removes some nefast constructs from a code line and returns the
|
||||
resulting line.
|
||||
*/
|
||||
QString QScriptIndenter::trimmedCodeLine(const QString &t)
|
||||
QString QmlJSIndenter::trimmedCodeLine(const QString &t)
|
||||
{
|
||||
QScriptIncrementalScanner scanner;
|
||||
QmlJSScanner scanner;
|
||||
|
||||
QTextBlock currentLine = yyLinizerState.iter;
|
||||
int startState = qMax(0, currentLine.previous().userState()) & 0xff;
|
||||
@@ -215,14 +215,14 @@ QString QScriptIndenter::trimmedCodeLine(const QString &t)
|
||||
yyLinizerState.tokens = scanner(t, startState);
|
||||
QString trimmed;
|
||||
int previousTokenEnd = 0;
|
||||
foreach (const QScriptIncrementalScanner::Token &token, yyLinizerState.tokens) {
|
||||
foreach (const QmlJSScanner::Token &token, yyLinizerState.tokens) {
|
||||
trimmed.append(t.midRef(previousTokenEnd, token.begin() - previousTokenEnd));
|
||||
|
||||
if (token.is(QScriptIncrementalScanner::Token::String)) {
|
||||
if (token.is(QmlJSScanner::Token::String)) {
|
||||
for (int i = 0; i < token.length; ++i)
|
||||
trimmed.append(QLatin1Char('X'));
|
||||
|
||||
} else if (token.is(QScriptIncrementalScanner::Token::Comment)) {
|
||||
} else if (token.is(QmlJSScanner::Token::Comment)) {
|
||||
for (int i = 0; i < token.length; ++i)
|
||||
trimmed.append(QLatin1Char(' '));
|
||||
|
||||
@@ -235,43 +235,43 @@ QString QScriptIndenter::trimmedCodeLine(const QString &t)
|
||||
|
||||
int index = yyLinizerState.tokens.size() - 1;
|
||||
for (; index != -1; --index) {
|
||||
const QScriptIncrementalScanner::Token &token = yyLinizerState.tokens.at(index);
|
||||
if (token.isNot(QScriptIncrementalScanner::Token::Comment))
|
||||
const QmlJSScanner::Token &token = yyLinizerState.tokens.at(index);
|
||||
if (token.isNot(QmlJSScanner::Token::Comment))
|
||||
break;
|
||||
}
|
||||
|
||||
bool isBinding = false;
|
||||
foreach (const QScriptIncrementalScanner::Token &token, yyLinizerState.tokens) {
|
||||
if (token.is(QScriptIncrementalScanner::Token::Colon)) {
|
||||
foreach (const QmlJSScanner::Token &token, yyLinizerState.tokens) {
|
||||
if (token.is(QmlJSScanner::Token::Colon)) {
|
||||
isBinding = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (index != -1) {
|
||||
const QScriptIncrementalScanner::Token &last = yyLinizerState.tokens.at(index);
|
||||
const QmlJSScanner::Token &last = yyLinizerState.tokens.at(index);
|
||||
|
||||
switch (last.kind) {
|
||||
case QScriptIncrementalScanner::Token::LeftParenthesis:
|
||||
case QScriptIncrementalScanner::Token::LeftBrace:
|
||||
case QScriptIncrementalScanner::Token::Semicolon:
|
||||
case QScriptIncrementalScanner::Token::Operator:
|
||||
case QmlJSScanner::Token::LeftParenthesis:
|
||||
case QmlJSScanner::Token::LeftBrace:
|
||||
case QmlJSScanner::Token::Semicolon:
|
||||
case QmlJSScanner::Token::Operator:
|
||||
break;
|
||||
|
||||
case QScriptIncrementalScanner::Token::RightParenthesis:
|
||||
case QScriptIncrementalScanner::Token::RightBrace:
|
||||
case QmlJSScanner::Token::RightParenthesis:
|
||||
case QmlJSScanner::Token::RightBrace:
|
||||
if (isBinding)
|
||||
trimmed.append(QLatin1Char(';'));
|
||||
break;
|
||||
|
||||
case QScriptIncrementalScanner::Token::Colon:
|
||||
case QScriptIncrementalScanner::Token::LeftBracket:
|
||||
case QScriptIncrementalScanner::Token::RightBracket:
|
||||
case QmlJSScanner::Token::Colon:
|
||||
case QmlJSScanner::Token::LeftBracket:
|
||||
case QmlJSScanner::Token::RightBracket:
|
||||
trimmed.append(QLatin1Char(';'));
|
||||
break;
|
||||
|
||||
case QScriptIncrementalScanner::Token::Identifier:
|
||||
case QScriptIncrementalScanner::Token::Keyword:
|
||||
case QmlJSScanner::Token::Identifier:
|
||||
case QmlJSScanner::Token::Keyword:
|
||||
if (t.midRef(last.offset, last.length) != QLatin1String("else"))
|
||||
trimmed.append(QLatin1Char(';'));
|
||||
break;
|
||||
@@ -289,7 +289,7 @@ QString QScriptIndenter::trimmedCodeLine(const QString &t)
|
||||
Returns '(' if the last parenthesis is opening, ')' if it is
|
||||
closing, and QChar() if there are no parentheses in t.
|
||||
*/
|
||||
QChar QScriptIndenter::lastParen(const QString &t) const
|
||||
QChar QmlJSIndenter::lastParen(const QString &t) const
|
||||
{
|
||||
int i = t.length();
|
||||
while (i > 0) {
|
||||
@@ -304,7 +304,7 @@ QChar QScriptIndenter::lastParen(const QString &t) const
|
||||
Returns true if typedIn the same as okayCh or is null; otherwise
|
||||
returns false.
|
||||
*/
|
||||
bool QScriptIndenter::okay(QChar typedIn, QChar okayCh) const
|
||||
bool QmlJSIndenter::okay(QChar typedIn, QChar okayCh) const
|
||||
{
|
||||
return typedIn == QChar() || typedIn == okayCh;
|
||||
}
|
||||
@@ -321,7 +321,7 @@ bool QScriptIndenter::okay(QChar typedIn, QChar okayCh) const
|
||||
accordingly. yyLine is cleaned from comments and other damageable
|
||||
constructs. Empty lines are skipped.
|
||||
*/
|
||||
bool QScriptIndenter::readLine()
|
||||
bool QmlJSIndenter::readLine()
|
||||
{
|
||||
int k;
|
||||
|
||||
@@ -395,7 +395,7 @@ bool QScriptIndenter::readLine()
|
||||
Resets the linizer to its initial state, with yyLine containing the
|
||||
line above the bottom line of the program.
|
||||
*/
|
||||
void QScriptIndenter::startLinizer()
|
||||
void QmlJSIndenter::startLinizer()
|
||||
{
|
||||
yyLinizerState.braceDepth = 0;
|
||||
yyLinizerState.pendingRightBrace = false;
|
||||
@@ -415,7 +415,7 @@ void QScriptIndenter::startLinizer()
|
||||
potentially the whole line) is part of a C-style comment;
|
||||
otherwise returns false.
|
||||
*/
|
||||
bool QScriptIndenter::bottomLineStartsInMultilineComment()
|
||||
bool QmlJSIndenter::bottomLineStartsInMultilineComment()
|
||||
{
|
||||
QTextBlock currentLine = yyProgram.lastBlock().previous();
|
||||
QTextBlock previousLine = currentLine.previous();
|
||||
@@ -435,7 +435,7 @@ bool QScriptIndenter::bottomLineStartsInMultilineComment()
|
||||
Essentially, we're trying to align against some text on the
|
||||
previous line.
|
||||
*/
|
||||
int QScriptIndenter::indentWhenBottomLineStartsInMultiLineComment()
|
||||
int QmlJSIndenter::indentWhenBottomLineStartsInMultiLineComment()
|
||||
{
|
||||
QTextBlock block = yyProgram.lastBlock().previous();
|
||||
QString blockText;
|
||||
@@ -468,7 +468,7 @@ int QScriptIndenter::indentWhenBottomLineStartsInMultiLineComment()
|
||||
if (x)
|
||||
y;
|
||||
*/
|
||||
bool QScriptIndenter::matchBracelessControlStatement()
|
||||
bool QmlJSIndenter::matchBracelessControlStatement()
|
||||
{
|
||||
int delimDepth = 0;
|
||||
|
||||
@@ -553,7 +553,7 @@ bool QScriptIndenter::matchBracelessControlStatement()
|
||||
f + // unfinished continuation line
|
||||
g; // continuation line
|
||||
*/
|
||||
bool QScriptIndenter::isUnfinishedLine()
|
||||
bool QmlJSIndenter::isUnfinishedLine()
|
||||
{
|
||||
bool unf = false;
|
||||
|
||||
@@ -600,7 +600,7 @@ bool QScriptIndenter::isUnfinishedLine()
|
||||
Returns true if yyLine is a continuation line; otherwise returns
|
||||
false.
|
||||
*/
|
||||
bool QScriptIndenter::isContinuationLine()
|
||||
bool QmlJSIndenter::isContinuationLine()
|
||||
{
|
||||
bool cont = false;
|
||||
|
||||
@@ -619,7 +619,7 @@ bool QScriptIndenter::isContinuationLine()
|
||||
or other bracked left opened on a previous line, or some interesting
|
||||
operator such as '='.
|
||||
*/
|
||||
int QScriptIndenter::indentForContinuationLine()
|
||||
int QmlJSIndenter::indentForContinuationLine()
|
||||
{
|
||||
int braceDepth = 0;
|
||||
int delimDepth = 0;
|
||||
@@ -863,7 +863,7 @@ int QScriptIndenter::indentForContinuationLine()
|
||||
accommodate people with irregular indentation schemes. A hook line
|
||||
near at hand is much more reliable than a remote one.
|
||||
*/
|
||||
int QScriptIndenter::indentForStandaloneLine()
|
||||
int QmlJSIndenter::indentForStandaloneLine()
|
||||
{
|
||||
for (int i = 0; i < SmallRoof; i++) {
|
||||
if (!*yyLeftBraceFollows) {
|
||||
@@ -948,7 +948,7 @@ int QScriptIndenter::indentForStandaloneLine()
|
||||
slighly more liberal if typedIn is always null. The user might be
|
||||
annoyed by the liberal behavior.
|
||||
*/
|
||||
int QScriptIndenter::indentForBottomLine(QTextBlock begin, QTextBlock end, QChar typedIn)
|
||||
int QmlJSIndenter::indentForBottomLine(QTextBlock begin, QTextBlock end, QChar typedIn)
|
||||
{
|
||||
if (begin == end)
|
||||
return 0;
|
||||
@@ -27,11 +27,11 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef QTSCRIPTINDENTER_H
|
||||
#define QTSCRIPTINDENTER_H
|
||||
#ifndef QMLJSINDENTER_H
|
||||
#define QMLJSINDENTER_H
|
||||
|
||||
#include <qmljs/qml_global.h>
|
||||
#include <qmljs/qscriptincrementalscanner.h>
|
||||
#include <qmljs/qmljs_global.h>
|
||||
#include <qmljs/qmljsscanner.h>
|
||||
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QStringList>
|
||||
@@ -39,13 +39,13 @@
|
||||
|
||||
namespace QmlJS {
|
||||
|
||||
class QML_EXPORT QScriptIndenter
|
||||
class QMLJS_EXPORT QmlJSIndenter
|
||||
{
|
||||
Q_DISABLE_COPY(QScriptIndenter)
|
||||
Q_DISABLE_COPY(QmlJSIndenter)
|
||||
|
||||
public:
|
||||
QScriptIndenter();
|
||||
~QScriptIndenter();
|
||||
QmlJSIndenter();
|
||||
~QmlJSIndenter();
|
||||
|
||||
void setTabSize(int size);
|
||||
void setIndentSize(int size);
|
||||
@@ -103,7 +103,7 @@ private:
|
||||
bool leftBraceFollows;
|
||||
bool pendingRightBrace;
|
||||
QString line;
|
||||
QList<QScriptIncrementalScanner::Token> tokens;
|
||||
QList<QmlJSScanner::Token> tokens;
|
||||
QTextBlock iter;
|
||||
};
|
||||
|
||||
@@ -136,5 +136,5 @@ private:
|
||||
|
||||
} // namespace QmlJS
|
||||
|
||||
#endif // QTSCRIPTINDENTER_H
|
||||
#endif // QMLJSINDENTER_H
|
||||
|
||||
@@ -27,17 +27,17 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "qmlmetatypebackend.h"
|
||||
#include "qmltypesystem.h"
|
||||
#include "qmljsmetatypebackend.h"
|
||||
#include "qmljstypesystem.h"
|
||||
|
||||
using namespace Qml;
|
||||
using namespace QmlJS;
|
||||
|
||||
QmlMetaTypeBackend::QmlMetaTypeBackend(QmlTypeSystem *typeSystem):
|
||||
MetaTypeBackend::MetaTypeBackend(TypeSystem *typeSystem):
|
||||
m_typeSystem(typeSystem)
|
||||
{
|
||||
Q_ASSERT(typeSystem);
|
||||
}
|
||||
|
||||
QmlMetaTypeBackend::~QmlMetaTypeBackend()
|
||||
MetaTypeBackend::~MetaTypeBackend()
|
||||
{
|
||||
}
|
||||
@@ -30,29 +30,29 @@
|
||||
#ifndef QMLMETATYPEBACKEND_H
|
||||
#define QMLMETATYPEBACKEND_H
|
||||
|
||||
#include <qmljs/qml_global.h>
|
||||
#include <qmljs/qmlpackageinfo.h>
|
||||
#include <qmljs/qmlsymbol.h>
|
||||
#include <qmljs/qmljs_global.h>
|
||||
#include <qmljs/qmljspackageinfo.h>
|
||||
#include <qmljs/qmljssymbol.h>
|
||||
|
||||
namespace Qml {
|
||||
namespace QmlJS {
|
||||
|
||||
class QmlTypeSystem;
|
||||
class TypeSystem;
|
||||
|
||||
class QML_EXPORT QmlMetaTypeBackend
|
||||
class QMLJS_EXPORT MetaTypeBackend
|
||||
{
|
||||
public:
|
||||
QmlMetaTypeBackend(QmlTypeSystem *typeSystem);
|
||||
virtual ~QmlMetaTypeBackend() = 0;
|
||||
MetaTypeBackend(TypeSystem *typeSystem);
|
||||
virtual ~MetaTypeBackend() = 0;
|
||||
|
||||
virtual QList<QmlSymbol *> availableTypes(const QString &package, int majorVersion, int minorVersion) = 0;
|
||||
virtual QmlSymbol *resolve(const QString &typeName, const QList<PackageInfo> &packages) = 0;
|
||||
virtual QList<Symbol *> availableTypes(const QString &package, int majorVersion, int minorVersion) = 0;
|
||||
virtual Symbol *resolve(const QString &typeName, const QList<PackageInfo> &packages) = 0;
|
||||
|
||||
protected:
|
||||
QmlTypeSystem *typeSystem() const
|
||||
TypeSystem *typeSystem() const
|
||||
{ return m_typeSystem; }
|
||||
|
||||
private:
|
||||
QmlTypeSystem *m_typeSystem;
|
||||
TypeSystem *m_typeSystem;
|
||||
};
|
||||
|
||||
} // namespace Qml
|
||||
@@ -27,9 +27,9 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "qmlpackageinfo.h"
|
||||
#include "qmljspackageinfo.h"
|
||||
|
||||
using namespace Qml;
|
||||
using namespace QmlJS;
|
||||
|
||||
PackageInfo::PackageInfo(const QString &name, int majorVersion, int minorVersion):
|
||||
m_name(name),
|
||||
@@ -30,13 +30,13 @@
|
||||
#ifndef PACKAGEINFO_H
|
||||
#define PACKAGEINFO_H
|
||||
|
||||
#include <qmljs/qml_global.h>
|
||||
#include <qmljs/qmljs_global.h>
|
||||
|
||||
#include <QtCore/QString>
|
||||
|
||||
namespace Qml {
|
||||
namespace QmlJS {
|
||||
|
||||
class QML_EXPORT PackageInfo
|
||||
class QMLJS_EXPORT PackageInfo
|
||||
{
|
||||
public:
|
||||
PackageInfo(const QString &name, int majorVersion, int minorVersion);
|
||||
@@ -27,28 +27,28 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include <qmljs/qscriptincrementalscanner.h>
|
||||
#include <qmljs/qmljsscanner.h>
|
||||
|
||||
#include <QTextCharFormat>
|
||||
|
||||
using namespace QmlJS;
|
||||
|
||||
QScriptIncrementalScanner::QScriptIncrementalScanner()
|
||||
QmlJSScanner::QmlJSScanner()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
QScriptIncrementalScanner::~QScriptIncrementalScanner()
|
||||
QmlJSScanner::~QmlJSScanner()
|
||||
{}
|
||||
|
||||
void QScriptIncrementalScanner::reset()
|
||||
void QmlJSScanner::reset()
|
||||
{
|
||||
m_endState = -1;
|
||||
m_firstNonSpace = -1;
|
||||
m_tokens.clear();
|
||||
}
|
||||
|
||||
QList<QScriptIncrementalScanner::Token> QScriptIncrementalScanner::operator()(const QString &text, int startState)
|
||||
QList<QmlJSScanner::Token> QmlJSScanner::operator()(const QString &text, int startState)
|
||||
{
|
||||
reset();
|
||||
|
||||
@@ -301,7 +301,7 @@ QList<QScriptIncrementalScanner::Token> QScriptIncrementalScanner::operator()(co
|
||||
return m_tokens;
|
||||
}
|
||||
|
||||
void QScriptIncrementalScanner::insertToken(int start, int length, Token::Kind kind, bool forceNewToken)
|
||||
void QmlJSScanner::insertToken(int start, int length, Token::Kind kind, bool forceNewToken)
|
||||
{
|
||||
if (m_tokens.isEmpty() || forceNewToken) {
|
||||
m_tokens.append(Token(start, length, kind));
|
||||
@@ -316,7 +316,7 @@ void QScriptIncrementalScanner::insertToken(int start, int length, Token::Kind k
|
||||
}
|
||||
}
|
||||
|
||||
void QScriptIncrementalScanner::insertCharToken(int start, const char c)
|
||||
void QmlJSScanner::insertCharToken(int start, const char c)
|
||||
{
|
||||
Token::Kind kind;
|
||||
|
||||
@@ -348,7 +348,7 @@ void QScriptIncrementalScanner::insertCharToken(int start, const char c)
|
||||
insertToken(start, 1, kind, true);
|
||||
}
|
||||
|
||||
void QScriptIncrementalScanner::scanForKeywords(const QString &text)
|
||||
void QmlJSScanner::scanForKeywords(const QString &text)
|
||||
{
|
||||
for (int i = 0; i < m_tokens.length(); ++i) {
|
||||
Token &t(m_tokens[i]);
|
||||
@@ -27,10 +27,10 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef QSCRIPTINCREMENTALSCANNER_H
|
||||
#define QSCRIPTINCREMENTALSCANNER_H
|
||||
#ifndef QMLJSSCANNER_H
|
||||
#define QMLJSSCANNER_H
|
||||
|
||||
#include <qmljs/qml_global.h>
|
||||
#include <qmljs/qmljs_global.h>
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QSet>
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
namespace QmlJS {
|
||||
|
||||
class QML_EXPORT QScriptIncrementalScanner
|
||||
class QMLJS_EXPORT QmlJSScanner
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -72,15 +72,15 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
QScriptIncrementalScanner();
|
||||
virtual ~QScriptIncrementalScanner();
|
||||
QmlJSScanner();
|
||||
virtual ~QmlJSScanner();
|
||||
|
||||
void setKeywords(const QSet<QString> keywords)
|
||||
{ m_keywords = keywords;; }
|
||||
|
||||
void reset();
|
||||
|
||||
QList<QScriptIncrementalScanner::Token> operator()(const QString &text, int startState = 0);
|
||||
QList<QmlJSScanner::Token> operator()(const QString &text, int startState = 0);
|
||||
|
||||
int endState() const
|
||||
{ return m_endState; }
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
int firstNonSpace() const
|
||||
{ return m_firstNonSpace; }
|
||||
|
||||
QList<QScriptIncrementalScanner::Token> tokens() const
|
||||
QList<QmlJSScanner::Token> tokens() const
|
||||
{ return m_tokens; }
|
||||
|
||||
private:
|
||||
@@ -110,9 +110,9 @@ private:
|
||||
QSet<QString> m_keywords;
|
||||
int m_endState;
|
||||
int m_firstNonSpace;
|
||||
QList<QScriptIncrementalScanner::Token> m_tokens;
|
||||
QList<QmlJSScanner::Token> m_tokens;
|
||||
};
|
||||
|
||||
} // namespace QmlJS
|
||||
|
||||
#endif // QSCRIPTINCREMENTALSCANNER_H
|
||||
#endif // QMLJSSCANNER_H
|
||||
@@ -27,56 +27,56 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "qmlsymbol.h"
|
||||
#include "qmljssymbol.h"
|
||||
|
||||
#include <qmljs/parser/qmljsast_p.h>
|
||||
#include <qmljs/parser/qmljsengine_p.h>
|
||||
|
||||
using namespace Qml;
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::AST;
|
||||
|
||||
QmlSymbol::~QmlSymbol()
|
||||
Symbol::~Symbol()
|
||||
{
|
||||
}
|
||||
|
||||
bool QmlSymbol::isBuildInSymbol()
|
||||
{ return asBuildInSymbol() != 0; }
|
||||
bool Symbol::isBuildInSymbol()
|
||||
{ return asPrimitiveSymbol() != 0; }
|
||||
|
||||
bool QmlSymbol::isSymbolFromFile()
|
||||
bool Symbol::isSymbolFromFile()
|
||||
{ return asSymbolFromFile() != 0; }
|
||||
|
||||
bool QmlSymbol::isIdSymbol()
|
||||
bool Symbol::isIdSymbol()
|
||||
{ return asIdSymbol() != 0; }
|
||||
|
||||
bool QmlSymbol::isPropertyDefinitionSymbol()
|
||||
bool Symbol::isPropertyDefinitionSymbol()
|
||||
{ return asPropertyDefinitionSymbol() != 0; }
|
||||
|
||||
QmlBuildInSymbol *QmlSymbol::asBuildInSymbol()
|
||||
PrimitiveSymbol *Symbol::asPrimitiveSymbol()
|
||||
{ return 0; }
|
||||
|
||||
QmlSymbolFromFile *QmlSymbol::asSymbolFromFile()
|
||||
SymbolFromFile *Symbol::asSymbolFromFile()
|
||||
{ return 0; }
|
||||
|
||||
QmlIdSymbol *QmlSymbol::asIdSymbol()
|
||||
IdSymbol *Symbol::asIdSymbol()
|
||||
{ return 0; }
|
||||
|
||||
QmlPropertyDefinitionSymbol *QmlSymbol::asPropertyDefinitionSymbol()
|
||||
PropertyDefinitionSymbol *Symbol::asPropertyDefinitionSymbol()
|
||||
{ return 0; }
|
||||
|
||||
QmlBuildInSymbol::~QmlBuildInSymbol()
|
||||
PrimitiveSymbol::~PrimitiveSymbol()
|
||||
{}
|
||||
|
||||
QmlBuildInSymbol *QmlBuildInSymbol::asBuildInSymbol()
|
||||
PrimitiveSymbol *PrimitiveSymbol::asPrimitiveSymbol()
|
||||
{ return this; }
|
||||
|
||||
QmlSymbolWithMembers::~QmlSymbolWithMembers()
|
||||
SymbolWithMembers::~SymbolWithMembers()
|
||||
{ qDeleteAll(_members); }
|
||||
|
||||
const QmlSymbol::List QmlSymbolWithMembers::members()
|
||||
const Symbol::List SymbolWithMembers::members()
|
||||
{ return _members; }
|
||||
|
||||
QmlSymbolFromFile::QmlSymbolFromFile(const QString &fileName, QmlJS::AST::UiObjectMember *node):
|
||||
SymbolFromFile::SymbolFromFile(const QString &fileName, QmlJS::AST::UiObjectMember *node):
|
||||
_fileName(fileName),
|
||||
_node(node)
|
||||
{
|
||||
@@ -97,16 +97,16 @@ QmlSymbolFromFile::QmlSymbolFromFile(const QString &fileName, QmlJS::AST::UiObje
|
||||
}
|
||||
}
|
||||
|
||||
QmlSymbolFromFile::~QmlSymbolFromFile()
|
||||
SymbolFromFile::~SymbolFromFile()
|
||||
{}
|
||||
|
||||
QmlSymbolFromFile *QmlSymbolFromFile::asSymbolFromFile()
|
||||
SymbolFromFile *SymbolFromFile::asSymbolFromFile()
|
||||
{ return this; }
|
||||
|
||||
int QmlSymbolFromFile::line() const
|
||||
int SymbolFromFile::line() const
|
||||
{ return _node->firstSourceLocation().startLine; }
|
||||
|
||||
int QmlSymbolFromFile::column() const
|
||||
int SymbolFromFile::column() const
|
||||
{ return _node->firstSourceLocation().startColumn; }
|
||||
|
||||
static inline QString toString(UiQualifiedId *qId)
|
||||
@@ -126,7 +126,7 @@ static inline QString toString(UiQualifiedId *qId)
|
||||
return result;
|
||||
}
|
||||
|
||||
const QString QmlSymbolFromFile::name() const
|
||||
const QString SymbolFromFile::name() const
|
||||
{
|
||||
if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(_node))
|
||||
return toString(objectBinding->qualifiedId);
|
||||
@@ -140,23 +140,23 @@ const QString QmlSymbolFromFile::name() const
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
const QmlSymbol::List QmlSymbolFromFile::members()
|
||||
const Symbol::List SymbolFromFile::members()
|
||||
{
|
||||
if (!todo.isEmpty()) {
|
||||
foreach (Node *todoNode, todo) {
|
||||
if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(todoNode))
|
||||
_members.append(new QmlSymbolFromFile(fileName(), objectBinding));
|
||||
_members.append(new SymbolFromFile(fileName(), objectBinding));
|
||||
else if (UiObjectDefinition *objectDefinition = cast<UiObjectDefinition*>(todoNode))
|
||||
_members.append(new QmlSymbolFromFile(fileName(), objectDefinition));
|
||||
_members.append(new SymbolFromFile(fileName(), objectDefinition));
|
||||
else if (UiArrayBinding *arrayBinding = cast<UiArrayBinding*>(todoNode))
|
||||
_members.append(new QmlSymbolFromFile(fileName(), arrayBinding));
|
||||
_members.append(new SymbolFromFile(fileName(), arrayBinding));
|
||||
else if (UiPublicMember *publicMember = cast<UiPublicMember*>(todoNode))
|
||||
_members.append(new QmlPropertyDefinitionSymbol(fileName(), publicMember));
|
||||
_members.append(new PropertyDefinitionSymbol(fileName(), publicMember));
|
||||
else if (UiScriptBinding *scriptBinding = cast<UiScriptBinding*>(todoNode)) {
|
||||
if (scriptBinding->qualifiedId && scriptBinding->qualifiedId->name && scriptBinding->qualifiedId->name->asString() == QLatin1String("id") && !scriptBinding->qualifiedId->next)
|
||||
_members.append(new QmlIdSymbol(fileName(), scriptBinding, this));
|
||||
_members.append(new IdSymbol(fileName(), scriptBinding, this));
|
||||
else
|
||||
_members.append(new QmlSymbolFromFile(fileName(), scriptBinding));
|
||||
_members.append(new SymbolFromFile(fileName(), scriptBinding));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,14 +166,14 @@ const QmlSymbol::List QmlSymbolFromFile::members()
|
||||
return _members;
|
||||
}
|
||||
|
||||
bool QmlSymbolFromFile::isProperty() const
|
||||
bool SymbolFromFile::isProperty() const
|
||||
{ return cast<UiObjectDefinition*>(_node) == 0; }
|
||||
|
||||
QmlSymbolFromFile *QmlSymbolFromFile::findMember(QmlJS::AST::Node *memberNode)
|
||||
SymbolFromFile *SymbolFromFile::findMember(QmlJS::AST::Node *memberNode)
|
||||
{
|
||||
List symbols = members();
|
||||
|
||||
foreach (QmlSymbol *symbol, symbols)
|
||||
foreach (Symbol *symbol, symbols)
|
||||
if (symbol->isSymbolFromFile())
|
||||
if (memberNode == symbol->asSymbolFromFile()->node())
|
||||
return symbol->asSymbolFromFile();
|
||||
@@ -181,24 +181,24 @@ QmlSymbolFromFile *QmlSymbolFromFile::findMember(QmlJS::AST::Node *memberNode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
QmlIdSymbol::QmlIdSymbol(const QString &fileName, QmlJS::AST::UiScriptBinding *idNode, QmlSymbolFromFile *parentNode):
|
||||
QmlSymbolFromFile(fileName, idNode),
|
||||
IdSymbol::IdSymbol(const QString &fileName, QmlJS::AST::UiScriptBinding *idNode, SymbolFromFile *parentNode):
|
||||
SymbolFromFile(fileName, idNode),
|
||||
_parentNode(parentNode)
|
||||
{}
|
||||
|
||||
QmlIdSymbol::~QmlIdSymbol()
|
||||
IdSymbol::~IdSymbol()
|
||||
{}
|
||||
|
||||
QmlIdSymbol *QmlIdSymbol::asIdSymbol()
|
||||
IdSymbol *IdSymbol::asIdSymbol()
|
||||
{ return this; }
|
||||
|
||||
int QmlIdSymbol::line() const
|
||||
int IdSymbol::line() const
|
||||
{ return idNode()->statement->firstSourceLocation().startLine; }
|
||||
|
||||
int QmlIdSymbol::column() const
|
||||
int IdSymbol::column() const
|
||||
{ return idNode()->statement->firstSourceLocation().startColumn; }
|
||||
|
||||
const QString QmlIdSymbol::id() const
|
||||
const QString IdSymbol::id() const
|
||||
{
|
||||
if (ExpressionStatement *e = cast<ExpressionStatement*>(idNode()->statement))
|
||||
if (IdentifierExpression *i = cast<IdentifierExpression*>(e->expression))
|
||||
@@ -208,27 +208,27 @@ const QString QmlIdSymbol::id() const
|
||||
return QString();
|
||||
}
|
||||
|
||||
QmlJS::AST::UiScriptBinding *QmlIdSymbol::idNode() const
|
||||
QmlJS::AST::UiScriptBinding *IdSymbol::idNode() const
|
||||
{ return cast<UiScriptBinding*>(node()); }
|
||||
|
||||
QmlPropertyDefinitionSymbol::QmlPropertyDefinitionSymbol(const QString &fileName, QmlJS::AST::UiPublicMember *propertyNode):
|
||||
QmlSymbolFromFile(fileName, propertyNode)
|
||||
PropertyDefinitionSymbol::PropertyDefinitionSymbol(const QString &fileName, QmlJS::AST::UiPublicMember *propertyNode):
|
||||
SymbolFromFile(fileName, propertyNode)
|
||||
{}
|
||||
|
||||
QmlPropertyDefinitionSymbol::~QmlPropertyDefinitionSymbol()
|
||||
PropertyDefinitionSymbol::~PropertyDefinitionSymbol()
|
||||
{}
|
||||
|
||||
QmlPropertyDefinitionSymbol *QmlPropertyDefinitionSymbol::asPropertyDefinitionSymbol()
|
||||
PropertyDefinitionSymbol *PropertyDefinitionSymbol::asPropertyDefinitionSymbol()
|
||||
{ return this; }
|
||||
|
||||
int QmlPropertyDefinitionSymbol::line() const
|
||||
int PropertyDefinitionSymbol::line() const
|
||||
{ return propertyNode()->identifierToken.startLine; }
|
||||
|
||||
int QmlPropertyDefinitionSymbol::column() const
|
||||
int PropertyDefinitionSymbol::column() const
|
||||
{ return propertyNode()->identifierToken.startColumn; }
|
||||
|
||||
QmlJS::AST::UiPublicMember *QmlPropertyDefinitionSymbol::propertyNode() const
|
||||
QmlJS::AST::UiPublicMember *PropertyDefinitionSymbol::propertyNode() const
|
||||
{ return cast<UiPublicMember*>(node()); }
|
||||
|
||||
const QString QmlPropertyDefinitionSymbol::name() const
|
||||
const QString PropertyDefinitionSymbol::name() const
|
||||
{ return propertyNode()->name->asString(); }
|
||||
@@ -31,20 +31,20 @@
|
||||
#define QMLSYMBOL_H
|
||||
|
||||
#include <qmljs/parser/qmljsastfwd_p.h>
|
||||
#include <qmljs/qml_global.h>
|
||||
#include <qmljs/qmljs_global.h>
|
||||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
namespace Qml {
|
||||
namespace QmlJS {
|
||||
|
||||
class QML_EXPORT QmlSymbol
|
||||
class QMLJS_EXPORT Symbol
|
||||
{
|
||||
public:
|
||||
typedef QList<QmlSymbol *> List;
|
||||
typedef QList<Symbol *> List;
|
||||
|
||||
public:
|
||||
virtual ~QmlSymbol() = 0;
|
||||
virtual ~Symbol() = 0;
|
||||
|
||||
virtual const QString name() const = 0;
|
||||
virtual const List members() = 0;
|
||||
@@ -55,28 +55,28 @@ public:
|
||||
bool isIdSymbol();
|
||||
bool isPropertyDefinitionSymbol();
|
||||
|
||||
virtual class QmlBuildInSymbol *asBuildInSymbol();
|
||||
virtual class QmlSymbolFromFile *asSymbolFromFile();
|
||||
virtual class QmlIdSymbol *asIdSymbol();
|
||||
virtual class QmlPropertyDefinitionSymbol *asPropertyDefinitionSymbol();
|
||||
virtual class PrimitiveSymbol *asPrimitiveSymbol();
|
||||
virtual class SymbolFromFile *asSymbolFromFile();
|
||||
virtual class IdSymbol *asIdSymbol();
|
||||
virtual class PropertyDefinitionSymbol *asPropertyDefinitionSymbol();
|
||||
};
|
||||
|
||||
class QML_EXPORT QmlBuildInSymbol: public QmlSymbol
|
||||
class QMLJS_EXPORT PrimitiveSymbol: public Symbol
|
||||
{
|
||||
public:
|
||||
virtual ~QmlBuildInSymbol() = 0;
|
||||
virtual ~PrimitiveSymbol() = 0;
|
||||
|
||||
virtual QmlBuildInSymbol *asBuildInSymbol();
|
||||
virtual PrimitiveSymbol *asPrimitiveSymbol();
|
||||
|
||||
virtual QmlBuildInSymbol *type() const = 0;
|
||||
using QmlSymbol::members;
|
||||
virtual PrimitiveSymbol *type() const = 0;
|
||||
using Symbol::members;
|
||||
virtual List members(bool includeBaseClassMembers) = 0;
|
||||
};
|
||||
|
||||
class QML_EXPORT QmlSymbolWithMembers: public QmlSymbol
|
||||
class QMLJS_EXPORT SymbolWithMembers: public Symbol
|
||||
{
|
||||
public:
|
||||
virtual ~QmlSymbolWithMembers() = 0;
|
||||
virtual ~SymbolWithMembers() = 0;
|
||||
|
||||
virtual const List members();
|
||||
|
||||
@@ -84,13 +84,13 @@ protected:
|
||||
List _members;
|
||||
};
|
||||
|
||||
class QML_EXPORT QmlSymbolFromFile: public QmlSymbolWithMembers
|
||||
class QMLJS_EXPORT SymbolFromFile: public SymbolWithMembers
|
||||
{
|
||||
public:
|
||||
QmlSymbolFromFile(const QString &fileName, QmlJS::AST::UiObjectMember *node);
|
||||
virtual ~QmlSymbolFromFile();
|
||||
SymbolFromFile(const QString &fileName, QmlJS::AST::UiObjectMember *node);
|
||||
virtual ~SymbolFromFile();
|
||||
|
||||
virtual QmlSymbolFromFile *asSymbolFromFile();
|
||||
virtual SymbolFromFile *asSymbolFromFile();
|
||||
|
||||
QString fileName() const
|
||||
{ return _fileName; }
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
virtual const QString name() const;
|
||||
virtual const List members();
|
||||
virtual bool isProperty() const;
|
||||
virtual QmlSymbolFromFile *findMember(QmlJS::AST::Node *memberNode);
|
||||
virtual SymbolFromFile *findMember(QmlJS::AST::Node *memberNode);
|
||||
|
||||
private:
|
||||
void fillTodo(QmlJS::AST::UiObjectMemberList *members);
|
||||
@@ -115,18 +115,18 @@ private:
|
||||
QList<QmlJS::AST::Node*> todo;
|
||||
};
|
||||
|
||||
class QML_EXPORT QmlIdSymbol: public QmlSymbolFromFile
|
||||
class QMLJS_EXPORT IdSymbol: public SymbolFromFile
|
||||
{
|
||||
public:
|
||||
QmlIdSymbol(const QString &fileName, QmlJS::AST::UiScriptBinding *idNode, QmlSymbolFromFile *parentNode);
|
||||
virtual ~QmlIdSymbol();
|
||||
IdSymbol(const QString &fileName, QmlJS::AST::UiScriptBinding *idNode, SymbolFromFile *parentNode);
|
||||
virtual ~IdSymbol();
|
||||
|
||||
QmlIdSymbol *asIdSymbol();
|
||||
IdSymbol *asIdSymbol();
|
||||
|
||||
virtual int line() const;
|
||||
virtual int column() const;
|
||||
|
||||
QmlSymbolFromFile *parentNode() const
|
||||
SymbolFromFile *parentNode() const
|
||||
{ return _parentNode; }
|
||||
|
||||
virtual const QString name() const
|
||||
@@ -138,16 +138,16 @@ private:
|
||||
QmlJS::AST::UiScriptBinding *idNode() const;
|
||||
|
||||
private:
|
||||
QmlSymbolFromFile *_parentNode;
|
||||
SymbolFromFile *_parentNode;
|
||||
};
|
||||
|
||||
class QML_EXPORT QmlPropertyDefinitionSymbol: public QmlSymbolFromFile
|
||||
class QMLJS_EXPORT PropertyDefinitionSymbol: public SymbolFromFile
|
||||
{
|
||||
public:
|
||||
QmlPropertyDefinitionSymbol(const QString &fileName, QmlJS::AST::UiPublicMember *propertyNode);
|
||||
virtual ~QmlPropertyDefinitionSymbol();
|
||||
PropertyDefinitionSymbol(const QString &fileName, QmlJS::AST::UiPublicMember *propertyNode);
|
||||
virtual ~PropertyDefinitionSymbol();
|
||||
|
||||
QmlPropertyDefinitionSymbol *asPropertyDefinitionSymbol();
|
||||
PropertyDefinitionSymbol *asPropertyDefinitionSymbol();
|
||||
|
||||
virtual int line() const;
|
||||
virtual int column() const;
|
||||
@@ -27,8 +27,8 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "qmlmetatypebackend.h"
|
||||
#include "qmltypesystem.h"
|
||||
#include "qmljsmetatypebackend.h"
|
||||
#include "qmljstypesystem.h"
|
||||
|
||||
#ifdef BUILD_DECLARATIVE_BACKEND
|
||||
# include "qtdeclarativemetatypebackend.h"
|
||||
@@ -36,34 +36,34 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
using namespace Qml;
|
||||
using namespace QmlJS;
|
||||
|
||||
QmlTypeSystem::QmlTypeSystem()
|
||||
TypeSystem::TypeSystem()
|
||||
{
|
||||
#ifdef BUILD_DECLARATIVE_BACKEND
|
||||
backends.append(new Internal::QtDeclarativeMetaTypeBackend(this));
|
||||
#endif // BUILD_DECLARATIVE_BACKEND
|
||||
}
|
||||
|
||||
QmlTypeSystem::~QmlTypeSystem()
|
||||
TypeSystem::~TypeSystem()
|
||||
{
|
||||
qDeleteAll(backends);
|
||||
}
|
||||
|
||||
QList<QmlSymbol *> QmlTypeSystem::availableTypes(const QString &package, int majorVersion, int minorVersion)
|
||||
QList<Symbol *> TypeSystem::availableTypes(const QString &package, int majorVersion, int minorVersion)
|
||||
{
|
||||
QList<QmlSymbol *> results;
|
||||
QList<Symbol *> results;
|
||||
|
||||
foreach (QmlMetaTypeBackend *backend, backends)
|
||||
foreach (MetaTypeBackend *backend, backends)
|
||||
results.append(backend->availableTypes(package, majorVersion, minorVersion));
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
QmlSymbol *QmlTypeSystem::resolve(const QString &typeName, const QList<PackageInfo> &packages)
|
||||
Symbol *TypeSystem::resolve(const QString &typeName, const QList<PackageInfo> &packages)
|
||||
{
|
||||
foreach (QmlMetaTypeBackend *backend, backends)
|
||||
if (QmlSymbol *symbol = backend->resolve(typeName, packages))
|
||||
foreach (MetaTypeBackend *backend, backends)
|
||||
if (Symbol *symbol = backend->resolve(typeName, packages))
|
||||
return symbol;
|
||||
|
||||
return 0;
|
||||
@@ -30,30 +30,30 @@
|
||||
#ifndef QMLTYPESYSTEM_H
|
||||
#define QMLTYPESYSTEM_H
|
||||
|
||||
#include <qmljs/qml_global.h>
|
||||
#include <qmljs/qmlpackageinfo.h>
|
||||
#include <qmljs/qmlsymbol.h>
|
||||
#include <qmljs/qmljs_global.h>
|
||||
#include <qmljs/qmljspackageinfo.h>
|
||||
#include <qmljs/qmljssymbol.h>
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QObject>
|
||||
|
||||
namespace Qml {
|
||||
namespace QmlJS {
|
||||
|
||||
class QmlMetaTypeBackend;
|
||||
class MetaTypeBackend;
|
||||
|
||||
class QML_EXPORT QmlTypeSystem: public QObject
|
||||
class QMLJS_EXPORT TypeSystem: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QmlTypeSystem();
|
||||
virtual ~QmlTypeSystem();
|
||||
TypeSystem();
|
||||
virtual ~TypeSystem();
|
||||
|
||||
QList<QmlSymbol *> availableTypes(const QString &package, int majorVersion, int minorVersion);
|
||||
QmlSymbol *resolve(const QString &typeName, const QList<PackageInfo> &packages);
|
||||
QList<Symbol *> availableTypes(const QString &package, int majorVersion, int minorVersion);
|
||||
Symbol *resolve(const QString &typeName, const QList<PackageInfo> &packages);
|
||||
|
||||
private:
|
||||
QList<QmlMetaTypeBackend *> backends;
|
||||
QList<MetaTypeBackend *> backends;
|
||||
};
|
||||
|
||||
} // namespace Qml
|
||||
@@ -31,17 +31,17 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
namespace Qml {
|
||||
namespace QmlJS {
|
||||
namespace Internal {
|
||||
|
||||
class QmlDeclarativeSymbol: public QmlBuildInSymbol
|
||||
class DeclarativeSymbol: public PrimitiveSymbol
|
||||
{
|
||||
public:
|
||||
virtual ~QmlDeclarativeSymbol()
|
||||
virtual ~DeclarativeSymbol()
|
||||
{}
|
||||
|
||||
protected:
|
||||
QmlDeclarativeSymbol(QtDeclarativeMetaTypeBackend* backend):
|
||||
DeclarativeSymbol(QtDeclarativeMetaTypeBackend* backend):
|
||||
m_backend(backend)
|
||||
{ Q_ASSERT(backend); }
|
||||
|
||||
@@ -52,24 +52,24 @@ private:
|
||||
QtDeclarativeMetaTypeBackend* m_backend;
|
||||
};
|
||||
|
||||
class QmlDeclarativeObjectSymbol: public QmlDeclarativeSymbol
|
||||
class DeclarativeObjectSymbol: public DeclarativeSymbol
|
||||
{
|
||||
QmlDeclarativeObjectSymbol(const QmlDeclarativeObjectSymbol &);
|
||||
QmlDeclarativeObjectSymbol &operator=(const QmlDeclarativeObjectSymbol &);
|
||||
DeclarativeObjectSymbol(const DeclarativeObjectSymbol &);
|
||||
DeclarativeObjectSymbol &operator=(const DeclarativeObjectSymbol &);
|
||||
|
||||
public:
|
||||
QmlDeclarativeObjectSymbol(QtDeclarativeMetaTypeBackend* backend):
|
||||
QmlDeclarativeSymbol(backend)
|
||||
DeclarativeObjectSymbol(QtDeclarativeMetaTypeBackend* backend):
|
||||
DeclarativeSymbol(backend)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~QmlDeclarativeObjectSymbol()
|
||||
virtual ~DeclarativeObjectSymbol()
|
||||
{ qDeleteAll(m_members); }
|
||||
|
||||
virtual const QString name() const
|
||||
{ return m_name; }
|
||||
|
||||
virtual QmlBuildInSymbol *type() const
|
||||
virtual PrimitiveSymbol *type() const
|
||||
{ return 0; }
|
||||
|
||||
virtual const List members()
|
||||
@@ -114,24 +114,24 @@ private:
|
||||
List m_members;
|
||||
};
|
||||
|
||||
class QmlDeclarativePropertySymbol: public QmlDeclarativeSymbol
|
||||
class DeclarativePropertySymbol: public DeclarativeSymbol
|
||||
{
|
||||
QmlDeclarativePropertySymbol(const QmlDeclarativePropertySymbol &);
|
||||
QmlDeclarativePropertySymbol &operator=(const QmlDeclarativePropertySymbol &);
|
||||
DeclarativePropertySymbol(const DeclarativePropertySymbol &);
|
||||
DeclarativePropertySymbol &operator=(const DeclarativePropertySymbol &);
|
||||
|
||||
public:
|
||||
QmlDeclarativePropertySymbol(QtDeclarativeMetaTypeBackend* backend):
|
||||
QmlDeclarativeSymbol(backend)
|
||||
DeclarativePropertySymbol(QtDeclarativeMetaTypeBackend* backend):
|
||||
DeclarativeSymbol(backend)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~QmlDeclarativePropertySymbol()
|
||||
virtual ~DeclarativePropertySymbol()
|
||||
{}
|
||||
|
||||
virtual const QString name() const
|
||||
{ return QString(); }
|
||||
|
||||
virtual QmlBuildInSymbol *type() const
|
||||
virtual PrimitiveSymbol *type() const
|
||||
{ return 0; }
|
||||
|
||||
virtual const List members()
|
||||
@@ -153,11 +153,11 @@ private:
|
||||
} // namespace Internal
|
||||
} // namespace Qml
|
||||
|
||||
using namespace Qml;
|
||||
using namespace Qml::Internal;
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::Internal;
|
||||
|
||||
QtDeclarativeMetaTypeBackend::QtDeclarativeMetaTypeBackend(QmlTypeSystem *typeSystem):
|
||||
QmlMetaTypeBackend(typeSystem)
|
||||
QtDeclarativeMetaTypeBackend::QtDeclarativeMetaTypeBackend(TypeSystem *typeSystem):
|
||||
MetaTypeBackend(typeSystem)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -165,16 +165,16 @@ QtDeclarativeMetaTypeBackend::~QtDeclarativeMetaTypeBackend()
|
||||
{
|
||||
}
|
||||
|
||||
QList<QmlSymbol *> QtDeclarativeMetaTypeBackend::availableTypes(const QString &package, int majorVersion, int minorVersion)
|
||||
QList<Symbol *> QtDeclarativeMetaTypeBackend::availableTypes(const QString &package, int majorVersion, int minorVersion)
|
||||
{
|
||||
QList<QmlSymbol *> result;
|
||||
QList<Symbol *> result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QmlSymbol *QtDeclarativeMetaTypeBackend::resolve(const QString &typeName, const QList<PackageInfo> &packages)
|
||||
Symbol *QtDeclarativeMetaTypeBackend::resolve(const QString &typeName, const QList<PackageInfo> &packages)
|
||||
{
|
||||
QList<QmlSymbol *> result;
|
||||
QList<Symbol *> result;
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -30,37 +30,37 @@
|
||||
#ifndef QTDECLARATIVEMETATYPEBACKEND_H
|
||||
#define QTDECLARATIVEMETATYPEBACKEND_H
|
||||
|
||||
#include <qmljs/qmlmetatypebackend.h>
|
||||
#include <qmljs/qmljsmetatypebackend.h>
|
||||
|
||||
#include <QtCore/QList>
|
||||
|
||||
namespace Qml {
|
||||
namespace QmlJS {
|
||||
namespace Internal {
|
||||
|
||||
class QmlDeclarativeSymbol;
|
||||
class QmlDeclarativeObjectSymbol;
|
||||
class QmlDeclarativePropertySymbol;
|
||||
class DeclarativeSymbol;
|
||||
class DeclarativeObjectSymbol;
|
||||
class DeclarativePropertySymbol;
|
||||
|
||||
class QtDeclarativeMetaTypeBackend: public QmlMetaTypeBackend
|
||||
class QtDeclarativeMetaTypeBackend: public MetaTypeBackend
|
||||
{
|
||||
friend class QmlDeclarativeSymbol;
|
||||
friend class QmlDeclarativeObjectSymbol;
|
||||
friend class QmlDeclarativePropertySymbol;
|
||||
friend class DeclarativeSymbol;
|
||||
friend class DeclarativeObjectSymbol;
|
||||
friend class DeclarativePropertySymbol;
|
||||
|
||||
public:
|
||||
QtDeclarativeMetaTypeBackend(QmlTypeSystem *typeSystem);
|
||||
QtDeclarativeMetaTypeBackend(TypeSystem *typeSystem);
|
||||
~QtDeclarativeMetaTypeBackend();
|
||||
|
||||
virtual QList<QmlSymbol *> availableTypes(const QString &package, int majorVersion, int minorVersion);
|
||||
virtual QmlSymbol *resolve(const QString &typeName, const QList<PackageInfo> &packages);
|
||||
virtual QList<Symbol *> availableTypes(const QString &package, int majorVersion, int minorVersion);
|
||||
virtual Symbol *resolve(const QString &typeName, const QList<PackageInfo> &packages);
|
||||
|
||||
protected:
|
||||
// QList<QmlSymbol *> members(const Qml::NodeMetaInfo &metaInfo);
|
||||
// QList<QmlSymbol *> inheritedMembers(const Qml::NodeMetaInfo &metaInfo);
|
||||
// QmlDeclarativeSymbol *typeOf(const Qml::PropertyMetaInfo &metaInfo);
|
||||
// QList<QmlSymbol *> members(const QmlJS::NodeMetaInfo &metaInfo);
|
||||
// QList<QmlSymbol *> inheritedMembers(const QmlJS::NodeMetaInfo &metaInfo);
|
||||
// QmlDeclarativeSymbol *typeOf(const QmlJS::PropertyMetaInfo &metaInfo);
|
||||
|
||||
private:
|
||||
// QmlDeclarativeSymbol *getSymbol(const Qml::NodeMetaInfo &metaInfo);
|
||||
// QmlDeclarativeSymbol *getSymbol(const QmlJS::NodeMetaInfo &metaInfo);
|
||||
|
||||
private:
|
||||
// QMap<QString, QmlDeclarativeSymbol*> m_symbols;
|
||||
|
||||
Reference in New Issue
Block a user