forked from qt-creator/qt-creator
QmlJS: Stop doing significant work in constructors.
To avoid order-of-initialization problems. Reviewed-by: Thomas Hartmann
This commit is contained in:
@@ -540,7 +540,7 @@ LookupContext::Ptr SemanticInfo::lookupContext(const QList<QmlJS::AST::Node *> &
|
||||
if (m_context.isNull())
|
||||
return LookupContext::create(document, snapshot, path);
|
||||
|
||||
return LookupContext::create(document, snapshot, *m_context, path);
|
||||
return LookupContext::create(document, *m_context, path);
|
||||
}
|
||||
|
||||
static bool importContainsCursor(UiImport *importAst, unsigned cursorPosition)
|
||||
|
||||
@@ -83,6 +83,7 @@ public:
|
||||
, _context(context)
|
||||
, _builder(context, doc)
|
||||
{
|
||||
_builder.initializeRootScope();
|
||||
}
|
||||
|
||||
Result operator()(const QString &name, const ObjectValue *scope)
|
||||
@@ -555,7 +556,10 @@ static void find_helper(QFutureInterface<FindReferences::Usage> &future,
|
||||
return;
|
||||
|
||||
Link link(&context, snapshot, ModelManagerInterface::instance()->importPaths());
|
||||
link();
|
||||
|
||||
ScopeBuilder builder(&context, doc);
|
||||
builder.initializeRootScope();
|
||||
ScopeAstPath astPath(doc);
|
||||
builder.push(astPath(offset));
|
||||
|
||||
|
||||
@@ -133,7 +133,8 @@ SemanticInfo SemanticHighlighter::semanticInfo(const SemanticHighlighterSource &
|
||||
semanticInfo.document = doc;
|
||||
|
||||
QmlJS::Interpreter::Context *ctx = new QmlJS::Interpreter::Context(snapshot);
|
||||
QmlJS::Link link(ctx, snapshot, QmlJS::ModelManagerInterface::instance()->importPaths(), doc, &semanticInfo.semanticMessages);
|
||||
QmlJS::Link link(ctx, snapshot, QmlJS::ModelManagerInterface::instance()->importPaths());
|
||||
link(doc, &semanticInfo.semanticMessages);
|
||||
semanticInfo.m_context = QSharedPointer<const QmlJS::Interpreter::Context>(ctx);
|
||||
|
||||
QmlJS::Check checker(doc, ctx);
|
||||
|
||||
@@ -74,7 +74,8 @@ void QmlTaskManager::collectMessages(QFutureInterface<FileErrorMessages> &future
|
||||
{
|
||||
Interpreter::Context ctx(snapshot);
|
||||
QHash<QString, QList<DiagnosticMessage> > linkMessages;
|
||||
Link link(&ctx, snapshot, importPaths, &linkMessages);
|
||||
Link link(&ctx, snapshot, importPaths);
|
||||
link(&linkMessages);
|
||||
|
||||
foreach (const QString &fileName, files) {
|
||||
Document::Ptr document = snapshot.document(fileName);
|
||||
|
||||
Reference in New Issue
Block a user