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)) {
|
foreach (Symbol *overload, b->find(functionCallOp)) {
|
||||||
if (Function *funTy = overload->type()->asFunctionType()) {
|
if (Function *funTy = overload->type()->asFunctionType()) {
|
||||||
if (maybeValidPrototype(funTy, actualArgumentCount)) {
|
if (maybeValidPrototype(funTy, actualArgumentCount)) {
|
||||||
Function *proto = instantiate(namedTy->name(), funTy)->asFunctionType();
|
if (Function *proto = instantiate(namedTy->name(), funTy)->asFunctionType())
|
||||||
addResult(proto->returnType().simplified(), scope);
|
addResult(proto->returnType().simplified(), scope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -535,7 +535,7 @@ bool ResolveExpression::visit(ArrayAccessAST *ast)
|
|||||||
if (ClassOrNamespace *b = _context.lookupType(namedTy->name(), scope)) {
|
if (ClassOrNamespace *b = _context.lookupType(namedTy->name(), scope)) {
|
||||||
foreach (Symbol *overload, b->find(arrayAccessOp)) {
|
foreach (Symbol *overload, b->find(arrayAccessOp)) {
|
||||||
if (Function *funTy = overload->type()->asFunctionType()) {
|
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
|
// ### TODO: check the actual arguments
|
||||||
addResult(proto->returnType().simplified(), scope);
|
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 *Context::lookupType(const QmlJS::Document *doc, const QStringList &qmlTypeName)
|
||||||
{
|
{
|
||||||
const ObjectValue *objectValue = typeEnvironment(doc);
|
const ObjectValue *objectValue = typeEnvironment(doc);
|
||||||
|
|
||||||
|
foreach (const QString &name, qmlTypeName) {
|
||||||
if (!objectValue)
|
if (!objectValue)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
foreach (const QString &name, qmlTypeName) {
|
|
||||||
const Value *value = objectValue->property(name, this);
|
const Value *value = objectValue->property(name, this);
|
||||||
if (!value)
|
if (!value)
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user