@@ -168,7 +168,7 @@ def _add(final):
168
168
169
169
if function_arg :
170
170
if self .is_name_reserved_function_arg (requested ):
171
- assert requested not in self .names_in_use ( )
171
+ assert not self .is_name_in_use ( requested )
172
172
return _add (requested )
173
173
if self .is_name_reserved (requested ):
174
174
raise AssertionError (f"Cannot use '{ requested } ' as argument name as it is already in use" )
@@ -332,7 +332,7 @@ def add_assignment(self, name, value, allow_multiple=False):
332
332
333
333
x = value
334
334
"""
335
- if name not in self .scope .names_in_use ( ):
335
+ if not self .scope .is_name_in_use ( name ):
336
336
raise AssertionError (f"Cannot assign to unreserved name '{ name } '" )
337
337
338
338
if self .scope .has_assignment (name ):
@@ -391,7 +391,7 @@ def __init__(self, name, args=None, parent_scope=None, source=None):
391
391
if args is None :
392
392
args = ()
393
393
for arg in args :
394
- if arg in self .names_in_use ( ):
394
+ if self .is_name_in_use ( arg ):
395
395
raise AssertionError (f"Can't use '{ arg } ' as function argument name because it shadows other names" )
396
396
self .reserve_name (arg , function_arg = True )
397
397
self .args = args
@@ -687,7 +687,7 @@ class VariableReference(Expression):
687
687
child_elements = []
688
688
689
689
def __init__ (self , name , scope ):
690
- if name not in scope .names_in_use ( ):
690
+ if not scope .is_name_in_use ( name ):
691
691
raise AssertionError (f"Cannot refer to undefined variable '{ name } '" )
692
692
self .name = name
693
693
self .type = scope .get_name_properties (name ).get (PROPERTY_TYPE , UNKNOWN_TYPE )
@@ -708,7 +708,7 @@ class FunctionCall(Expression):
708
708
child_elements = ["args" , "kwargs" ]
709
709
710
710
def __init__ (self , function_name , args , kwargs , scope , expr_type = UNKNOWN_TYPE ):
711
- if function_name not in scope .names_in_use ( ):
711
+ if not scope .is_name_in_use ( function_name ):
712
712
raise AssertionError (f"Cannot call unknown function '{ function_name } '" )
713
713
self .function_name = function_name
714
714
self .args = list (args )
0 commit comments