Auto-detect non-assignable classes

Classes with references or const data are now marked as 'noassign'.
This renders many explicit `private: operator=` declarations redundant.
This commit is contained in:
Seth R Johnson 2019-02-14 07:18:33 -05:00
commit 03dd2ec39d
7 changed files with 11 additions and 14 deletions

View file

@ -779,6 +779,15 @@ Allocate():
if (Swig_storage_isstatic(n)) {
Setattr(n, "cplus:staticbase", inclass);
} else if (Cmp(Getattr(n, "kind"), "variable") == 0) {
/* Check member variable to determine whether assignment is valid */
if (GetFlag(n, "feature:immutable")) {
/* Can't assign a class with an immutable member variable */
Setattr(inclass, "allocate:noassign", "1");
} else if (SwigType_isreference(Getattr(n, "type"))) {
/* Can't assign a class with reference member data */
Setattr(inclass, "allocate:noassign", "1");
}
}
String *name = Getattr(n, "name");