Flutter Engine
The Flutter Engine
Classes | Functions
cpp_indexer Namespace Reference

Classes

class  _ClassInfo
 
class  _Indexer
 
class  Location
 
class  SymbolsIndex
 

Functions

SymbolsIndex load_index (str filename)
 

Function Documentation

◆ load_index()

SymbolsIndex cpp_indexer.load_index ( str  filename)
Load symbols index from the given file.

If index is out of date or missing it will be generated.

Definition at line 272 of file cpp_indexer.py.

272def load_index(filename: str) -> SymbolsIndex:
273 """Load symbols index from the given file.
274
275 If index is out of date or missing it will be generated.
276 """
277 index: SymbolsIndex
278
279 if os.path.exists(filename):
280 with open(filename, 'r', encoding='utf-8') as json_file:
281 index = _SymbolsIndexSchema.loads(json_file.read())
282 if _get_current_commit_hash() == index.commit:
283 logging.info('Loaded symbols index from %s', filename)
284 return index
285 logging.warning(
286 '%s is generated for commit %s while current commit is %s',
287 filename, index.commit, _get_current_commit_hash())
288
289 index = _index_source()
290 with open(filename, 'w', encoding='utf-8') as json_file:
291 json_file.write(_SymbolsIndexSchema.dumps(index))
292 logging.info(
293 'Successfully indexed C++ source and written symbols index into %s',
294 filename)
295 return index
SymbolsIndex load_index(str filename)
Definition: cpp_indexer.py:272