ValueType: function return type
This commit is contained in:
parent
cf179f82b6
commit
9738cc66eb
|
@ -3834,6 +3834,13 @@ void SymbolDatabase::setValueTypeInTokenList(Token *tokens)
|
||||||
if (Token::simpleMatch(parsedecl(tok->next(), &valuetype), ")"))
|
if (Token::simpleMatch(parsedecl(tok->next(), &valuetype), ")"))
|
||||||
::setValueType(tok, valuetype);
|
::setValueType(tok, valuetype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function
|
||||||
|
if (tok->previous() && tok->previous()->function() && tok->previous()->function()->retDef) {
|
||||||
|
ValueType valuetype;
|
||||||
|
if (Token::simpleMatch(parsedecl(tok->previous()->function()->retDef, &valuetype), "("))
|
||||||
|
::setValueType(tok, valuetype);
|
||||||
|
}
|
||||||
} else if (tok->variable()) {
|
} else if (tok->variable()) {
|
||||||
const Variable *var = tok->variable();
|
const Variable *var = tok->variable();
|
||||||
ValueType valuetype;
|
ValueType valuetype;
|
||||||
|
|
|
@ -3009,6 +3009,9 @@ private:
|
||||||
ASSERT_EQUALS("const int *", typeOf("const int *a; x = a + 1;", "a +"));
|
ASSERT_EQUALS("const int *", typeOf("const int *a; x = a + 1;", "a +"));
|
||||||
ASSERT_EQUALS("int * const", typeOf("int * const a; x = a + 1;", "+"));
|
ASSERT_EQUALS("int * const", typeOf("int * const a; x = a + 1;", "+"));
|
||||||
ASSERT_EQUALS("const int *", typeOf("const int a[20]; x = a + 1;", "+"));
|
ASSERT_EQUALS("const int *", typeOf("const int a[20]; x = a + 1;", "+"));
|
||||||
|
|
||||||
|
// function call..
|
||||||
|
ASSERT_EQUALS("int", typeOf("int a(int); a(5);", "( 5"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue