Commits

Georg Brandl committed 2d9befd

Fix tracebacks occurring for duplicate C++ domain objects.

  • Participants
  • Parent commits 69c3b65

Comments (0)

Files changed (3)

 Release 1.0.7 (in development)
 ==============================
 
+* Fix tracebacks occurring for duplicate C++ domain objects.
+
 
 Release 1.0.6 (Jan 04, 2011)
 ============================

File sphinx/domains/cpp.py

         return unicode(self).encode('utf-8')
 
     def __repr__(self):
-        return '<defexpr %s>' % self
+        return '<%s %s>' % (self.__class__.__name__, self)
 
 
 class PrimaryDefExpr(DefExpr):
     def add_target_and_index(self, sigobj, sig, signode):
         theid = sigobj.get_id()
         name = unicode(sigobj.name)
-        signode['names'].append(theid)
-        signode['ids'].append(theid)
-        signode['first'] = (not self.names)
-        self.state.document.note_explicit_target(signode)
+        if theid not in self.state.document.ids:
+            signode['names'].append(theid)
+            signode['ids'].append(theid)
+            signode['first'] = (not self.names)
+            self.state.document.note_explicit_target(signode)
 
-        self.env.domaindata['cpp']['objects'].setdefault(name,
-            (self.env.docname, self.objtype, theid))
+            self.env.domaindata['cpp']['objects'].setdefault(name,
+                (self.env.docname, self.objtype, theid))
 
         indextext = self.get_index_text(name)
         if indextext:

File tests/root/objects.txt

 
 
 Referencing :userdescrole:`myobj`.
+
+
+CPP domain
+==========
+
+.. cpp:class:: n::Array<T,d>
+
+   .. cpp:function:: T& operator[]( unsigned j )
+
+   .. cpp:function:: const T& operator[]( unsigned j ) const
+