forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.4'
Conflicts: qtcreator.pri src/libs/qmljs/qmljstypedescriptionreader.cpp tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp Change-Id: Id032187023bb42f259a87545ceeb3c965dd01a32
This commit is contained in:
@@ -259,6 +259,14 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
|
||||
default: enter(expression); continue;
|
||||
} break;
|
||||
|
||||
case ternary_op:
|
||||
if (kind == Colon) {
|
||||
enter(ternary_op_after_colon);
|
||||
enter(expression_continuation);
|
||||
break;
|
||||
}
|
||||
// fallthrough
|
||||
case ternary_op_after_colon:
|
||||
case expression:
|
||||
if (tryInsideExpression())
|
||||
break;
|
||||
@@ -333,18 +341,6 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
|
||||
default: leave(); continue;
|
||||
} break;
|
||||
|
||||
case ternary_op:
|
||||
if (tryInsideExpression())
|
||||
break;
|
||||
switch (kind) {
|
||||
case RightParenthesis:
|
||||
case RightBracket:
|
||||
case RightBrace:
|
||||
case Comma:
|
||||
case Semicolon: leave(); continue;
|
||||
case Colon: enter(expression); break; // entering expression makes maybe_continuation work
|
||||
} break;
|
||||
|
||||
case jsblock_open:
|
||||
case substatement_open:
|
||||
if (tryStatement())
|
||||
@@ -495,7 +491,8 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
|
||||
// some states might be continued on the next line
|
||||
if (topState == expression
|
||||
|| topState == expression_or_objectdefinition
|
||||
|| topState == objectliteral_assignment) {
|
||||
|| topState == objectliteral_assignment
|
||||
|| topState == ternary_op_after_colon) {
|
||||
enter(expression_maybe_continuation);
|
||||
}
|
||||
// multi-line comment start?
|
||||
|
||||
@@ -145,6 +145,7 @@ public: // must be public to make Q_GADGET introspection work
|
||||
bracket_element_maybe_objectdefinition, // after an identifier in bracket_element_start
|
||||
|
||||
ternary_op, // The ? : operator
|
||||
ternary_op_after_colon, // after the : in a ternary
|
||||
|
||||
jsblock_open,
|
||||
|
||||
|
||||
@@ -216,6 +216,7 @@ static void collectScopes(const QmlComponentChain *chain, QList<const ObjectValu
|
||||
|
||||
void ScopeChain::update() const
|
||||
{
|
||||
m_modified = false;
|
||||
m_all.clear();
|
||||
|
||||
m_all += m_globalScope;
|
||||
@@ -287,6 +288,8 @@ void ScopeChain::initializeRootScope()
|
||||
if (bind->rootObjectValue())
|
||||
m_jsScopes += bind->rootObjectValue();
|
||||
}
|
||||
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
void ScopeChain::makeComponentChain(
|
||||
|
||||
@@ -121,7 +121,7 @@ private:
|
||||
const JSImportScope *m_jsImports;
|
||||
QList<const ObjectValue *> m_jsScopes;
|
||||
|
||||
bool m_modified;
|
||||
mutable bool m_modified;
|
||||
mutable QList<const ObjectValue *> m_all;
|
||||
};
|
||||
|
||||
|
||||
@@ -146,12 +146,14 @@ void TypeDescriptionReader::readModule(UiObjectDefinition *ast)
|
||||
for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) {
|
||||
UiObjectMember *member = it->member;
|
||||
UiObjectDefinition *component = dynamic_cast<UiObjectDefinition *>(member);
|
||||
if (!component || toString(component->qualifiedTypeNameId) != "Component") {
|
||||
addWarning(member->firstSourceLocation(), "Expected only 'Component' object definitions");
|
||||
const QString typeName = toString(component->qualifiedTypeNameId);
|
||||
if (!component || (typeName != "Component" && typeName != "ModuleApi")) {
|
||||
addWarning(member->firstSourceLocation(), "Expected only 'Component' and 'ModuleApi' object definitions");
|
||||
continue;
|
||||
}
|
||||
|
||||
readComponent(component);
|
||||
if (typeName == QLatin1String("Component"))
|
||||
readComponent(component);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user