From fcf81b22ed8770bfc1cda01c2969f02463c76dc6 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Wed, 3 Feb 2010 15:59:15 +0100 Subject: Get rid of BindPtr. There is no reason to store the Bind object in a QSharedPointer because the `binder' has the same lifetime of its document. --- src/libs/qmljs/qmljsdocument.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/libs/qmljs/qmljsdocument.cpp') diff --git a/src/libs/qmljs/qmljsdocument.cpp b/src/libs/qmljs/qmljsdocument.cpp index a215198fe9..fc3fb9ec88 100644 --- a/src/libs/qmljs/qmljsdocument.cpp +++ b/src/libs/qmljs/qmljsdocument.cpp @@ -36,7 +36,6 @@ #include #include -using namespace QmlJS; using namespace QmlJS; using namespace QmlJS::AST; @@ -44,6 +43,7 @@ Document::Document(const QString &fileName) : _engine(0) , _pool(0) , _ast(0) + , _bind(0) , _documentRevision(0) , _parsedCorrectly(false) , _fileName(fileName) @@ -65,6 +65,9 @@ Document::Document(const QString &fileName) Document::~Document() { + if (_bind) + delete _bind; + if (_engine) delete _engine; @@ -131,6 +134,7 @@ bool Document::parseQml() Q_ASSERT(! _engine); Q_ASSERT(! _pool); Q_ASSERT(! _ast); + Q_ASSERT(! _bind); _engine = new Engine(); _pool = new NodePool(_fileName, _engine); @@ -144,7 +148,7 @@ bool Document::parseQml() _ast = parser.ast(); _diagnosticMessages = parser.diagnosticMessages(); - _bind = BindPtr(new Bind(this)); + _bind = new Bind(this); return _parsedCorrectly; } @@ -154,6 +158,7 @@ bool Document::parseJavaScript() Q_ASSERT(! _engine); Q_ASSERT(! _pool); Q_ASSERT(! _ast); + Q_ASSERT(! _bind); _engine = new Engine(); _pool = new NodePool(_fileName, _engine); @@ -167,7 +172,7 @@ bool Document::parseJavaScript() _ast = cast(parser.rootNode()); _diagnosticMessages = parser.diagnosticMessages(); - _bind = BindPtr(new Bind(this)); + _bind = new Bind(this); return _parsedCorrectly; } @@ -195,7 +200,7 @@ bool Document::parseExpression() return _parsedCorrectly; } -BindPtr Document::bind() const +Bind *Document::bind() const { return _bind; } @@ -214,11 +219,11 @@ void Snapshot::insert(const Document::Ptr &document) _documents.insert(document->fileName(), document); } -Document::PtrList Snapshot::importedDocuments(const Document::Ptr &doc, const QString &importPath) const +QList Snapshot::importedDocuments(const Document::Ptr &doc, const QString &importPath) const { // ### TODO: maybe we should add all imported documents in the parse Document::parse() method, regardless of whether they're in the path or not. - Document::PtrList result; + QList result; QString docPath = doc->path(); docPath += QLatin1Char('/'); -- cgit v1.2.1