src/tools/moc/moc.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
--- a/src/tools/moc/moc.cpp	Tue Jul 06 15:10:48 2010 +0300
+++ b/src/tools/moc/moc.cpp	Wed Aug 18 10:37:55 2010 +0300
@@ -1208,6 +1208,12 @@
         default: break;
         }
     }
+
+    //when searching commas within the default argument, we should take care of template depth (anglecount)
+    // unfortunatelly, we do not have enough semantic information to know if '<' is the operator< or
+    // the begining of a template type. so we just use heuristics.
+    int possible = -1;
+
     while (index < symbols.size()) {
         Token t = symbols.at(index++).token;
         switch (t) {
@@ -1226,8 +1232,16 @@
             && braceCount <= 0
             && brackCount <= 0
             && parenCount <= 0
-            && (target != RANGLE || angleCount <= 0))
+            && (target != RANGLE || angleCount <= 0)) {
+            if (target != COMMA || angleCount <= 0)
+                return true;
+            possible = index;
+        }
+
+        if (target == COMMA && t == EQ && possible != -1) {
+            index = possible;
             return true;
+        }
 
         if (braceCount < 0 || brackCount < 0 || parenCount < 0
             || (target == RANGLE && angleCount < 0)) {
@@ -1235,6 +1249,12 @@
             break;
         }
     }
+
+    if(target == COMMA && angleCount != 0 && possible != -1) {
+        index = possible;
+        return true;
+    }
+
     return false;
 }