@@ -3,7 +3,8 @@ use emmylua_parser::{LuaAstNode, LuaAstToken, LuaExpr, LuaForRangeStat};
33use crate :: {
44 compilation:: analyzer:: unresolve:: UnResolveIterVar , infer_expr, instantiate_doc_function,
55 tpl_pattern_match_args, DbIndex , InferFailReason , LuaDeclId , LuaInferCache ,
6- LuaOperatorMetaMethod , LuaType , LuaTypeCache , TypeOps , TypeSubstitutor , VariadicType ,
6+ LuaOperatorMetaMethod , LuaType , LuaTypeCache , TplContext , TypeOps , TypeSubstitutor ,
7+ VariadicType ,
78} ;
89
910use super :: LuaAnalyzer ;
@@ -149,19 +150,19 @@ pub fn infer_for_range_iter_expr_func(
149150 return Ok ( doc_function. get_variadic_ret ( ) ) ;
150151 }
151152 let mut substitutor = TypeSubstitutor :: new ( ) ;
153+ let mut context = TplContext {
154+ db,
155+ cache,
156+ substitutor : & mut substitutor,
157+ root : root,
158+ } ;
152159 let params = doc_function
153160 . get_params ( )
154161 . iter ( )
155162 . map ( |( _, opt_ty) | opt_ty. clone ( ) . unwrap_or ( LuaType :: Any ) )
156163 . collect :: < Vec < _ > > ( ) ;
157- tpl_pattern_match_args (
158- db,
159- cache,
160- & params,
161- & vec ! [ status_param. clone( ) . unwrap( ) ] ,
162- & root,
163- & mut substitutor,
164- ) ?;
164+
165+ tpl_pattern_match_args ( & mut context, & params, & vec ! [ status_param. clone( ) . unwrap( ) ] ) ?;
165166
166167 let instantiate_func = if let LuaType :: DocFunction ( f) =
167168 instantiate_doc_function ( db, & doc_function, & substitutor)
0 commit comments