forked from qt-creator/qt-creator
QmlJS: Enforce Context always being linked.
The default way of creating a Context is through Link. Change-Id: Ia81f7ce90ba2b33d02eed432a61be836d404bedd Reviewed-on: http://codereview.qt.nokia.com/1041 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
@@ -812,13 +812,12 @@ static void find_helper(QFutureInterface<FindReferences::Usage> &future,
|
||||
}
|
||||
|
||||
// find the scope for the name we're searching
|
||||
Context context(snapshot);
|
||||
Document::Ptr doc = snapshot.document(fileName);
|
||||
if (!doc)
|
||||
return;
|
||||
|
||||
Link link(&context, snapshot, ModelManagerInterface::instance()->importPaths());
|
||||
link();
|
||||
Link link(snapshot, ModelManagerInterface::instance()->importPaths());
|
||||
Context context = link();
|
||||
|
||||
ScopeBuilder builder(&context, doc);
|
||||
builder.initializeRootScope();
|
||||
|
||||
@@ -132,9 +132,8 @@ SemanticInfo SemanticHighlighter::semanticInfo(const SemanticHighlighterSource &
|
||||
semanticInfo.snapshot = snapshot;
|
||||
semanticInfo.document = doc;
|
||||
|
||||
QmlJS::Interpreter::Context *ctx = new QmlJS::Interpreter::Context(snapshot);
|
||||
QmlJS::Link link(ctx, snapshot, QmlJS::ModelManagerInterface::instance()->importPaths());
|
||||
link(doc, &semanticInfo.semanticMessages);
|
||||
QmlJS::Link link(snapshot, QmlJS::ModelManagerInterface::instance()->importPaths());
|
||||
QmlJS::Interpreter::Context *ctx = new QmlJS::Interpreter::Context(link(doc, &semanticInfo.semanticMessages));
|
||||
semanticInfo.m_context = QSharedPointer<const QmlJS::Interpreter::Context>(ctx);
|
||||
|
||||
QmlJS::Check checker(doc, ctx);
|
||||
|
||||
Reference in New Issue
Block a user