~bzoltan/kubuntu-packaging/decouple_cmake_plugin

« back to all changes in this revision

Viewing changes to src/libs/qmljs/qmljscheck.cpp

  • Committer: Timo Jyrinki
  • Date: 2013-12-02 09:16:15 UTC
  • mfrom: (1.1.29)
  • Revision ID: timo.jyrinki@canonical.com-20131202091615-xbj1os1f604ber1m
New upstream release candidate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
538
538
    , _scopeBuilder(&_scopeChain)
539
539
    , _importsOk(false)
540
540
    , _inStatementBinding(false)
 
541
    , _imports(0)
 
542
    , _isQtQuick2(false)
 
543
 
541
544
{
542
 
    const Imports *imports = context->imports(doc.data());
543
 
    if (imports && !imports->importFailed())
 
545
    _imports = context->imports(doc.data());
 
546
    if (_imports && !_imports->importFailed()) {
544
547
        _importsOk = true;
 
548
        _isQtQuick2 = isQtQuick2();
 
549
    }
545
550
 
546
551
    _enabledMessages = Message::allMessageTypes().toSet();
547
552
    disableMessage(HintAnonymousFunctionSpacing);
737
742
            if (iter.error() != PrototypeIterator::NoError)
738
743
                typeError = true;
739
744
            const ObjectValue *lastPrototype = prototypes.last();
 
745
            foreach (const ObjectValue *objectValue, prototypes) {
 
746
                if (objectValue->className() == QLatin1String("QGraphicsObject")
 
747
                        && _isQtQuick2) {
 
748
                    addMessage(WarnAboutQtQuick1InsteadQtQuick2, typeErrorLocation);
 
749
                }
 
750
            }
 
751
 
740
752
            if (iter.error() == PrototypeIterator::ReferenceResolutionError) {
741
753
                if (const QmlPrototypeReference *ref =
742
754
                        value_cast<QmlPrototypeReference>(lastPrototype->prototype())) {
1355
1367
    }
1356
1368
}
1357
1369
 
 
1370
bool Check::isQtQuick2() const
 
1371
{
 
1372
    foreach (const Import &import, _imports->all()) {
 
1373
        if (import.info.name() == QLatin1String("QtQuick")
 
1374
                && import.info.version().majorVersion() == 2)
 
1375
            return true;
 
1376
    }
 
1377
    return false;
 
1378
}
 
1379
 
1358
1380
bool Check::visit(NewExpression *ast)
1359
1381
{
1360
1382
    checkNewExpression(ast->expression);