diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-04-11 15:50:53 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-09 19:10:16 -0300 |
commit | a4196f6b63d3050a7bc631e6276e17e0af4dc1eb (patch) | |
tree | 92a24b1a9b9fcdb6bcec2e77ade1d1ab7583a338 | |
parent | e3019fc3e235bee97447a80f0ec9424d3171898c (diff) |
Add AbstractMetaFunction::isCallOperator() method.
Returns true when the function is a call operator.
Reviewer: Renato Araújo <renato.filho@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r-- | abstractmetalang.cpp | 7 | ||||
-rw-r--r-- | abstractmetalang.h | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/abstractmetalang.cpp b/abstractmetalang.cpp index 509a7c1d2..3b7adb167 100644 --- a/abstractmetalang.cpp +++ b/abstractmetalang.cpp @@ -709,6 +709,11 @@ QString AbstractMetaFunction::argumentName(int index, bool create, const Abstrac return m_arguments[--index]->name(); } +bool AbstractMetaFunction::isCallOperator() const +{ + return m_name == "operator()"; +} + bool AbstractMetaFunction::hasInjectedCode() const { foreach (const FunctionModification mod, modifications(ownerClass())) { @@ -855,7 +860,7 @@ bool AbstractMetaFunction::isOtherOperator() const int AbstractMetaFunction::arityOfOperator() const { - if (!isOperatorOverload()) + if (!isOperatorOverload() || isCallOperator()) return -1; int arity = m_arguments.size(); diff --git a/abstractmetalang.h b/abstractmetalang.h index 4f1f25400..b58a00f24 100644 --- a/abstractmetalang.h +++ b/abstractmetalang.h @@ -804,7 +804,8 @@ public: m_reverse(false), m_userAdded(false), m_explicit(false), - m_pointerOperator(false) + m_pointerOperator(false), + m_isCallOperator(false) { } @@ -1160,6 +1161,8 @@ public: { m_typeEntry = typeEntry; } + + bool isCallOperator() const; private: QString m_name; QString m_originalName; @@ -1182,6 +1185,7 @@ private: uint m_userAdded : 1; uint m_explicit : 1; uint m_pointerOperator : 1; + uint m_isCallOperator : 1; }; |