コード例 #1
0
IAsyncJob::AsyncPrepareResult UpdateAnnotationsJob::prepareAsyncRun()
{
    const JobRequest jobRequest = context().jobRequest;
    QTC_ASSERT(isExpectedJobRequestType(jobRequest), return AsyncPrepareResult());
    QTC_ASSERT(acquireDocument(), return AsyncPrepareResult());

    const TranslationUnit translationUnit = *m_translationUnit;
    const TranslationUnitUpdateInput updateInput = createUpdateInput(m_pinnedDocument);
    setRunner([translationUnit, updateInput]() {
        TIME_SCOPE_DURATION("UpdateAnnotationsJobRunner");

        // Update
        UpdateAnnotationsJob::AsyncResult asyncResult;
        asyncResult.updateResult = translationUnit.update(updateInput);

        // Collect
        translationUnit.extractAnnotations(asyncResult.firstHeaderErrorDiagnostic,
                                           asyncResult.diagnostics,
                                           asyncResult.tokenInfos,
                                           asyncResult.skippedSourceRanges);
        asyncResult.unresolvedFilePaths.unite(
            unresolvedFilePaths({asyncResult.firstHeaderErrorDiagnostic}));
        asyncResult.unresolvedFilePaths.unite(unresolvedFilePaths(asyncResult.diagnostics));

        return asyncResult;
    });

    return AsyncPrepareResult{translationUnit.id()};
}
コード例 #2
0
IAsyncJob::AsyncPrepareResult UpdateExtraDocumentAnnotationsJob::prepareAsyncRun()
{
    const JobRequest jobRequest = context().jobRequest;
    QTC_ASSERT(acquireDocument(), return AsyncPrepareResult());

    const TranslationUnit translationUnit = *m_translationUnit;
    setRunner([translationUnit]() {
        TIME_SCOPE_DURATION("UpdateExtraDocumentAnnotationsJobRunner");
        return translationUnit.fullTokenInfos().toTokenInfoContainers();
    });

    return AsyncPrepareResult{translationUnit.id()};
}
コード例 #3
0
ファイル: runner.cpp プロジェクト: FOSSEE-Internship/scilab
bool StaticRunner::exec(ast::Exp* _theProgram, ast::RunVisitor *_visitor)
{
    Runner *runMe = new Runner(_theProgram, _visitor);
    setRunner(runMe);

    try
    {
        launch();
    }
    catch (const ast::InternalAbort& /*ia*/)
    {
        //catch exit command in .start or .quit
        return false;
    }

    return true;
}
コード例 #4
0
ファイル: runner.cpp プロジェクト: FOSSEE-Internship/scilab
void StaticRunner::execAndWait(ast::Exp* _theProgram, ast::RunVisitor *_visitor,
                               bool /*_isPrioritaryThread*/, bool _isInterruptible, command_origin_t _iCommandOrigin)
{
    if (isRunnerAvailable())
    {
        // wait for managenement of last Runner
        ThreadManagement::WaitForAvailableRunnerSignal();
    }

    // lock runner to be sure we are waiting for
    // "AwakeRunner" signal before start execution
    ThreadManagement::LockRunner();
    Runner *runMe = new Runner(_theProgram, _visitor, _iCommandOrigin, _isInterruptible);
    setRunner(runMe);

    ThreadManagement::SendRunMeSignal();
    ThreadManagement::WaitForAwakeRunnerSignal();
}
コード例 #5
0
bool RequestDocumentAnnotationsJob::prepareAsyncRun()
{
    const JobRequest jobRequest = context().jobRequest;
    QTC_ASSERT(jobRequest.type == JobRequest::Type::RequestDocumentAnnotations, return false);

    try {
        m_pinnedTranslationUnit = context().translationUnitForJobRequest();
        m_pinnedFileContainer = m_pinnedTranslationUnit.fileContainer();

        const TranslationUnitCore translationUnitCore = m_pinnedTranslationUnit.translationUnitCore();
        setRunner([translationUnitCore]() {
            return runAsyncHelper(translationUnitCore);
        });

    } catch (const std::exception &exception) {
        qWarning() << "Error in RequestDocumentAnnotationsJob::prepareAsyncRun:" << exception.what();
        return false;
    }

    return true;
}
コード例 #6
0
IAsyncJob::AsyncPrepareResult UpdateDocumentAnnotationsJob::prepareAsyncRun()
{
    const JobRequest jobRequest = context().jobRequest;
    QTC_ASSERT(jobRequest.type == JobRequest::Type::UpdateDocumentAnnotations,
               return AsyncPrepareResult());

    try {
        m_pinnedDocument = context().documentForJobRequest();
        m_pinnedFileContainer = m_pinnedDocument.fileContainer();

        const TranslationUnit translationUnit
                = m_pinnedDocument.translationUnit(jobRequest.preferredTranslationUnit);
        const TranslationUnitUpdateInput updateInput = m_pinnedDocument.createUpdateInput();
        setRunner([translationUnit, updateInput]() {
            return runAsyncHelper(translationUnit, updateInput);
        });
        return AsyncPrepareResult{translationUnit.id()};

    } catch (const std::exception &exception) {
        qWarning() << "Error in UpdateDocumentAnnotationsJob::prepareAsyncRun:" << exception.what();
        return AsyncPrepareResult();
    }
}
コード例 #7
0
bool CompleteCodeJob::prepareAsyncRun()
{
    const JobRequest jobRequest = context().jobRequest;
    QTC_ASSERT(jobRequest.type == JobRequest::Type::CompleteCode, return false);

    try {
        m_pinnedTranslationUnit = context().translationUnitForJobRequest();

        const TranslationUnitCore translationUnitCore = m_pinnedTranslationUnit.translationUnitCore();
        const UnsavedFiles unsavedFiles = *context().unsavedFiles;
        const quint32 line = jobRequest.line;
        const quint32 column = jobRequest.column;
        setRunner([translationUnitCore, unsavedFiles, line, column]() {
            return runAsyncHelper(translationUnitCore, unsavedFiles, line, column);
        });


    } catch (const std::exception &exception) {
        qWarning() << "Error in CompleteCodeJob::prepareAsyncRun:" << exception.what();
        return false;
    }

    return true;
}