@@ -1005,10 +1005,10 @@ def __repr__(self):
1005
1005
def get_match_count (self , vars = {}):
1006
1006
return self .pattern .get_match_count (vars )
1007
1007
1008
- def match (self , yield_func , expression , vars , evaluation , ** kwargs ):
1009
- existing = vars .get (self .varname , None )
1008
+ def match (self , yield_func , expression , vars_dict , evaluation , ** kwargs ):
1009
+ existing = vars_dict .get (self .varname , None )
1010
1010
if existing is None :
1011
- new_vars = vars .copy ()
1011
+ new_vars = vars_dict .copy ()
1012
1012
new_vars [self .varname ] = expression
1013
1013
# for vars_2, rest in self.pattern.match(
1014
1014
# expression, new_vars, evaluation):
@@ -1021,22 +1021,24 @@ def match(self, yield_func, expression, vars, evaluation, **kwargs):
1021
1021
self .pattern .match (yield_func , expression , new_vars , evaluation )
1022
1022
else :
1023
1023
if existing .sameQ (expression ):
1024
- yield_func (vars , None )
1024
+ yield_func (vars_dict , None )
1025
1025
1026
1026
def get_match_candidates (
1027
- self , elements : tuple , expression , attributes , evaluation , vars = {}
1027
+ self , elements : tuple , expression , attributes , evaluation , vars_dict = None
1028
1028
):
1029
- existing = vars .get (self .varname , None )
1029
+ if vars_dict is None :
1030
+ vars_dict = {}
1031
+ existing = vars_dict .get (self .varname , None )
1030
1032
if existing is None :
1031
1033
return self .pattern .get_match_candidates (
1032
- elements , expression , attributes , evaluation , vars
1034
+ elements , expression , attributes , evaluation , vars_dict
1033
1035
)
1034
1036
else :
1035
1037
# Treat existing variable as verbatim
1036
1038
verbatim_expr = Expression (SymbolVerbatim , existing )
1037
1039
verbatim = Verbatim (verbatim_expr )
1038
1040
return verbatim .get_match_candidates (
1039
- elements , expression , attributes , evaluation , vars
1041
+ elements , expression , attributes , evaluation , vars_dict
1040
1042
)
1041
1043
1042
1044
0 commit comments