@@ -199,37 +199,41 @@ def get_tokens(_source: str, _data_only: bool = False) -> Generator[Token, None,
199199
200200 async def get_general_model (self , document : TextDocument , data_only : bool = True ) -> ast .AST :
201201 if data_only :
202- return await document .get_cache (self .__get_general_model_data_only )
203- return await document .get_cache (self .__get_general_model )
202+ return await document .get_cache (
203+ self .__get_general_model_data_only , await self .get_general_tokens (document , True )
204+ )
205+ return await document .get_cache (self .__get_general_model , await self .get_general_tokens (document ))
204206
205- async def __get_general_model_data_only (self , document : TextDocument ) -> ast .AST :
206- return self .__get_model (document , await self . get_general_tokens ( document , True ) , DocumentType .GENERAL )
207+ async def __get_general_model_data_only (self , document : TextDocument , tokens : Iterable [ Any ] ) -> ast .AST :
208+ return self .__get_model (document , tokens , DocumentType .GENERAL )
207209
208- async def __get_general_model (self , document : TextDocument ) -> ast .AST :
209- return self .__get_model (document , await self . get_general_tokens ( document ) , DocumentType .GENERAL )
210+ async def __get_general_model (self , document : TextDocument , tokens : Iterable [ Any ] ) -> ast .AST :
211+ return self .__get_model (document , tokens , DocumentType .GENERAL )
210212
211213 async def get_resource_model (self , document : TextDocument , data_only : bool = True ) -> ast .AST :
212214 if data_only :
213- return await document .get_cache (self .__get_resource_model_data_only )
215+ return await document .get_cache (
216+ self .__get_resource_model_data_only , await self .get_resource_tokens (document , True )
217+ )
214218
215- return await document .get_cache (self .__get_resource_model )
219+ return await document .get_cache (self .__get_resource_model , await self . get_resource_tokens ( document ) )
216220
217- async def __get_resource_model_data_only (self , document : TextDocument ) -> ast .AST :
218- return self .__get_model (document , await self . get_resource_tokens ( document , True ) , DocumentType .RESOURCE )
221+ async def __get_resource_model_data_only (self , document : TextDocument , tokens : Iterable [ Any ] ) -> ast .AST :
222+ return self .__get_model (document , tokens , DocumentType .RESOURCE )
219223
220- async def __get_resource_model (self , document : TextDocument ) -> ast .AST :
221- return self .__get_model (document , await self . get_resource_tokens ( document ) , DocumentType .RESOURCE )
224+ async def __get_resource_model (self , document : TextDocument , tokens : Iterable [ Any ] ) -> ast .AST :
225+ return self .__get_model (document , tokens , DocumentType .RESOURCE )
222226
223227 async def get_init_model (self , document : TextDocument , data_only : bool = True ) -> ast .AST :
224228 if data_only :
225- return await document .get_cache (self .__get_init_model_data_only )
226- return await document .get_cache (self .__get_init_model )
229+ return await document .get_cache (self .__get_init_model_data_only , await self . get_init_tokens ( document , True ) )
230+ return await document .get_cache (self .__get_init_model , await self . get_init_tokens ( document ) )
227231
228- async def __get_init_model_data_only (self , document : TextDocument ) -> ast .AST :
229- return self .__get_model (document , await self . get_init_tokens ( document , True ) , DocumentType .INIT )
232+ async def __get_init_model_data_only (self , document : TextDocument , tokens : Iterable [ Any ] ) -> ast .AST :
233+ return self .__get_model (document , tokens , DocumentType .INIT )
230234
231- async def __get_init_model (self , document : TextDocument ) -> ast .AST :
232- return self .__get_model (document , await self . get_init_tokens ( document ) , DocumentType .INIT )
235+ async def __get_init_model (self , document : TextDocument , tokens : Iterable [ Any ] ) -> ast .AST :
236+ return self .__get_model (document , tokens , DocumentType .INIT )
233237
234238 async def get_namespace (self , document : TextDocument ) -> Namespace :
235239 return await document .get_cache (self .__get_namespace )
0 commit comments