Skip to content

Commit 9c994a1

Browse files
committed
Rename variables in find_noncopyable_vars
There are two types of 'type_' variables in this function. To prevent confusion and ease reading, they are renamed to represent their usage. Commit cherry-picked from the develop branch
1 parent 4874689 commit 9c994a1

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

pygccxml/declarations/type_traits_classes.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def find_copy_constructor(type_):
152152
return None
153153

154154

155-
def find_noncopyable_vars(type_, already_visited_cls_vars=None):
155+
def find_noncopyable_vars(class_type, already_visited_cls_vars=None):
156156
"""
157157
Returns list of all `noncopyable` variables.
158158
@@ -161,18 +161,19 @@ def find_noncopyable_vars(type_, already_visited_cls_vars=None):
161161
whatever variables pointing to classes have been found.
162162
163163
Args:
164-
type_ (declarations.class_t): the class to be searched.
164+
class_type (declarations.class_t): the class to be searched.
165165
already_visited_cls_vars (list): optional list of vars that should not
166166
be checked a second time, to prevent infinite recursions.
167167
168168
Returns:
169169
list: list of all `noncopyable` variables.
170170
171171
"""
172-
assert isinstance(type_, class_declaration.class_t)
172+
173+
assert isinstance(class_type, class_declaration.class_t)
173174

174175
logger = utils.loggers.cxx_parser
175-
mvars = type_.variables(
176+
mvars = class_type.variables(
176177
lambda v: not v.type_qualifiers.has_static,
177178
recursive=False,
178179
allow_empty=True)
@@ -187,25 +188,25 @@ def find_noncopyable_vars(type_, already_visited_cls_vars=None):
187188

188189
for mvar in mvars:
189190

190-
type_ = type_traits.remove_reference(mvar.decl_type)
191+
var_type = type_traits.remove_reference(mvar.decl_type)
191192

192-
if type_traits.is_const(type_):
193-
no_const = type_traits.remove_const(type_)
193+
if type_traits.is_const(var_type):
194+
no_const = type_traits.remove_const(var_type)
194195
if type_traits.is_fundamental(no_const) or is_enum(no_const):
195196
logger.debug(
196197
(message + "- fundamental or enum"),
197-
type_.decl_string)
198+
var_type.decl_string)
198199
noncopyable_vars.append(mvar)
199200
if is_class(no_const):
200-
logger.debug((message + " - class"), type_.decl_string)
201+
logger.debug((message + " - class"), var_type.decl_string)
201202
noncopyable_vars.append(mvar)
202203
if type_traits.is_array(no_const):
203-
logger.debug((message + " - array"), type_.decl_string)
204+
logger.debug((message + " - array"), var_type.decl_string)
204205
noncopyable_vars.append(mvar)
205206

206-
if class_traits.is_my_case(type_):
207+
if class_traits.is_my_case(var_type):
207208

208-
cls = class_traits.get_declaration(type_)
209+
cls = class_traits.get_declaration(var_type)
209210

210211
# Exclude classes that have already been visited.
211212
if cls in already_visited_cls_vars:
@@ -215,12 +216,12 @@ def find_noncopyable_vars(type_, already_visited_cls_vars=None):
215216
if is_noncopyable(cls, already_visited_cls_vars):
216217
logger.debug(
217218
(message + " - class that is not copyable"),
218-
type_.decl_string)
219+
var_type.decl_string)
219220
noncopyable_vars.append(mvar)
220221

221222
logger.debug((
222223
"__contains_noncopyable_mem_var - %s - FALSE - doesn't " +
223-
"contain noncopyable members"), type_.decl_string)
224+
"contain noncopyable members"), class_type.decl_string)
224225

225226
return noncopyable_vars
226227

0 commit comments

Comments
 (0)