File tree Expand file tree Collapse file tree 1 file changed +22
-7
lines changed Expand file tree Collapse file tree 1 file changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -736,22 +736,37 @@ def __str__(self):
736736
737737 @property
738738 def is_copy_constructor (self ):
739- """returns True if described declaration is copy constructor,
740- otherwise False"""
739+ """
740+ Returns True if described declaration is copy constructor,
741+ otherwise False
742+
743+ """
744+
741745 from . import type_traits
746+
742747 args = self .arguments
743- if 1 != len (args ):
748+
749+ # A copy constructor has only one argument
750+ if len (args ) != 1 :
744751 return False
752+
753+ # We have only one argument, get it
745754 arg = args [0 ]
755+
756+ # The argument needs to be passed by reference in a copy constructor
746757 if not type_traits .is_reference (arg .type ):
747758 return False
759+
760+ # The argument needs to be const for a copy constructor
748761 if not type_traits .is_const (arg .type .base ):
749762 return False
750- unaliased = type_traits .remove_alias (arg .type .base )
751- # unaliased now refers to const_t instance
752- if not isinstance (unaliased .base , cpptypes .declarated_t ):
763+
764+ un_aliased = type_traits .remove_alias (arg .type .base )
765+ # un_aliased now refers to const_t instance
766+ if not isinstance (un_aliased .base , cpptypes .declarated_t ):
753767 return False
754- return id (unaliased .base .declaration ) == id (self .parent )
768+
769+ return id (un_aliased .base .declaration ) == id (self .parent )
755770
756771 @property
757772 def is_trivial_constructor (self ):
You can’t perform that action at this time.
0 commit comments