C# Class Pytocs.TypeInference.AstCache

Provides a factory for python source ASTs. Maintains configurable on-disk and in-memory caches to avoid re-parsing files during analysis.
Exibir arquivo Open project: uxmal/pytocs Class Usage Examples

Public Methods

Method Description
AstCache ( Analyzer analyzer, IFileSystem fs, ILogger logger, string cacheDir ) : Pytocs.Syntax
Clear ( ) : void

Clears the memory cache.

clearDiskCache ( ) : bool

Removes all serialized ASTs from the on-disk cache.

close ( ) : void
getAST ( string path ) : Module

Returns the syntax tree for path. May find and/or create a cached copy in the mem cache or the disk cache. Absolute path to a source file. The AST, or null if the parse failed for any reason

getCachePath ( string sourcePath ) : string

Each source file's AST is saved in an object file named for the MD5 checksum of the source file. All that is needed is the MD5, but the file's base name is included for ease of debugging.

Private Methods

Method Description
GetSerializedModule ( string sourcePath ) : Module
deserialize ( string sourcePath ) : Module

Method Details

AstCache() public method

public AstCache ( Analyzer analyzer, IFileSystem fs, ILogger logger, string cacheDir ) : Pytocs.Syntax
analyzer Analyzer
fs IFileSystem
logger ILogger
cacheDir string
return Pytocs.Syntax

Clear() public method

Clears the memory cache.
public Clear ( ) : void
return void

clearDiskCache() public method

Removes all serialized ASTs from the on-disk cache.
public clearDiskCache ( ) : bool
return bool

close() public method

public close ( ) : void
return void

getAST() public method

Returns the syntax tree for path. May find and/or create a cached copy in the mem cache or the disk cache. Absolute path to a source file. The AST, or null if the parse failed for any reason
public getAST ( string path ) : Module
path string
return Pytocs.Syntax.Module

getCachePath() public method

Each source file's AST is saved in an object file named for the MD5 checksum of the source file. All that is needed is the MD5, but the file's base name is included for ease of debugging.
public getCachePath ( string sourcePath ) : string
sourcePath string
return string