forked from qt-creator/qt-creator
Fixed a couple of null-checks/-returns.
This commit is contained in:
@@ -491,7 +491,7 @@ bool ResolveExpression::visit(CallAST *ast)
|
||||
foreach (Symbol *overload, b->find(functionCallOp)) {
|
||||
if (Function *funTy = overload->type()->asFunctionType()) {
|
||||
if (maybeValidPrototype(funTy, actualArgumentCount)) {
|
||||
Function *proto = instantiate(namedTy->name(), funTy)->asFunctionType();
|
||||
if (Function *proto = instantiate(namedTy->name(), funTy)->asFunctionType())
|
||||
addResult(proto->returnType().simplified(), scope);
|
||||
}
|
||||
}
|
||||
@@ -535,7 +535,7 @@ bool ResolveExpression::visit(ArrayAccessAST *ast)
|
||||
if (ClassOrNamespace *b = _context.lookupType(namedTy->name(), scope)) {
|
||||
foreach (Symbol *overload, b->find(arrayAccessOp)) {
|
||||
if (Function *funTy = overload->type()->asFunctionType()) {
|
||||
Function *proto = instantiate(namedTy->name(), funTy)->asFunctionType();
|
||||
if (Function *proto = instantiate(namedTy->name(), funTy)->asFunctionType())
|
||||
// ### TODO: check the actual arguments
|
||||
addResult(proto->returnType().simplified(), scope);
|
||||
}
|
||||
|
||||
@@ -1469,10 +1469,11 @@ const ObjectValue *Context::lookupType(const QmlJS::Document *doc, UiQualifiedId
|
||||
const ObjectValue *Context::lookupType(const QmlJS::Document *doc, const QStringList &qmlTypeName)
|
||||
{
|
||||
const ObjectValue *objectValue = typeEnvironment(doc);
|
||||
|
||||
foreach (const QString &name, qmlTypeName) {
|
||||
if (!objectValue)
|
||||
return 0;
|
||||
|
||||
foreach (const QString &name, qmlTypeName) {
|
||||
const Value *value = objectValue->property(name, this);
|
||||
if (!value)
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user