@@ -161,7 +161,7 @@ def apply_fn(node, var_list):
161
161
""" We need to treat a variable and for loop seperately because a string in a for loop is actually an array """
162
162
if node .kind == 'assignment' :
163
163
name , value = node .word .split ('=' , maxsplit = 1 )
164
- var_list = add_variable_to_list (var_list , name , value )
164
+ var_list = add_variable_to_list (var_list , name , value , append = False )
165
165
elif node .kind == 'for' :
166
166
var_list = update_var_list_with_for_loop (node , var_list )
167
167
return CONT
@@ -170,7 +170,7 @@ def apply_fn(node, var_list):
170
170
return var_list
171
171
172
172
173
- def add_variable_to_list (var_list , name , values ):
173
+ def add_variable_to_list (var_list , name , values , append = True ):
174
174
""" (variable dict, name, value) Adds the corresponding name and value to dictionary. If name exists in
175
175
the dictionary, the value is added. Prevents bugs with use of the var_list """
176
176
@@ -182,7 +182,7 @@ def add_variable_to_list(var_list, name, values):
182
182
for i , val in enumerate (values ):
183
183
if type (val ) is not str and type (val ) is not bashlex .ast .node : values [i ] = str (val )
184
184
185
- if name in var_list :
185
+ if name in var_list and append :
186
186
for val in values :
187
187
if val not in var_list [name ]:
188
188
var_list [name ] += [ val ]
0 commit comments