Fixed a couple of null-checks/-returns.

This commit is contained in:
Erik Verbruggen
2010-06-04 10:14:22 +02:00
parent 10ed2c536e
commit eed0241d97
2 changed files with 8 additions and 7 deletions

View File

@@ -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);
}

View File

@@ -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;