aboutsummaryrefslogtreecommitdiffstats
path: root/typesystem.cpp
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2009-10-29 20:02:53 -0200
committerHugo Lima <hugo.lima@openbossa.org>2009-10-29 20:02:53 -0200
commit5ccbce7a917a2a602ad1fa32d8682afe32dd68bc (patch)
tree942b5597debf365a140c072816cb2726782937b6 /typesystem.cpp
parent64f7ae3334171168ff803f339d55a179a6e06001 (diff)
Fix a crash when the function signature provided by add-function tag does not
have parenteses. Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'typesystem.cpp')
-rw-r--r--typesystem.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/typesystem.cpp b/typesystem.cpp
index 1046aed6d..6d9cbe918 100644
--- a/typesystem.cpp
+++ b/typesystem.cpp
@@ -2109,18 +2109,23 @@ AddedFunction::AddedFunction(QString signature, QString returnType) : m_access(P
m_returnType = parseType(returnType);
signature = signature.trimmed();
int endPos = signature.indexOf('(');
- m_name = signature.left(endPos).trimmed();
- int signatureLength = signature.length();
- while (endPos < signatureLength) {
- TypeInfo arg = parseType(signature, endPos, &endPos);
- if (!arg.name.isEmpty())
- m_arguments.append(arg);
- // end of parameters...
- if (signature[endPos] == ')')
- break;
+ if (endPos < 0) {
+ m_isConst = false;
+ m_name = signature;
+ } else {
+ m_name = signature.left(endPos).trimmed();
+ int signatureLength = signature.length();
+ while (endPos < signatureLength) {
+ TypeInfo arg = parseType(signature, endPos, &endPos);
+ if (!arg.name.isEmpty())
+ m_arguments.append(arg);
+ // end of parameters...
+ if (signature[endPos] == ')')
+ break;
+ }
+ // is const?
+ m_isConst = signature.right(signatureLength - endPos).contains("const");
}
- // is const?
- m_isConst = signature.right(signatureLength - endPos).contains("const");
}
/*