Interface ICompiler
- Namespace
- Ecng.Compilation
- Assembly
- Ecng.Compilation.dll
Defines the contract for a compiler that supports compiling source files into an assembly.
public interface ICompiler
- Extension Methods
Properties
Extension
Gets the file extension used by the compiler.
string Extension { get; }
Property Value
IsAssemblyPersistable
Gets a value indicating whether the compiled assembly can be persisted.
bool IsAssemblyPersistable { get; }
Property Value
IsCaseSensitive
Gets a value indicating whether the language is case sensitive.
bool IsCaseSensitive { get; }
Property Value
IsReferencesSupported
Gets a value indicating whether the compiler supports external references.
bool IsReferencesSupported { get; }
Property Value
IsTabsSupported
Gets a value indicating whether the compiler supports tabs in the source code.
bool IsTabsSupported { get; }
Property Value
Methods
Analyse(object, IEnumerable<object>, string, IEnumerable<string>, IEnumerable<(string name, byte[] body)>, CancellationToken)
Analyzes the provided source code using the specified analyzer and settings.
Task<CompilationError[]> Analyse(object analyzer, IEnumerable<object> analyzerSettings, string name, IEnumerable<string> sources, IEnumerable<(string name, byte[] body)> refs, CancellationToken cancellationToken = default)
Parameters
analyzer
objectThe analyzer used to perform the analysis.
analyzerSettings
IEnumerable<object>The settings applied to the analyzer.
name
stringThe name of the compilation unit.
sources
IEnumerable<string>The source code files as strings.
refs
IEnumerable<(string name, byte[] body)>A collection of references as tuples containing the name and binary content.
cancellationToken
CancellationTokenA token to monitor for cancellation requests.
Returns
- Task<CompilationError[]>
A task that represents the asynchronous analysis operation. The task result contains an array of CompilationError instances.
Compile(string, IEnumerable<string>, IEnumerable<(string name, byte[] body)>, CancellationToken)
Compiles the provided source code files with the specified references.
Task<CompilationResult> Compile(string name, IEnumerable<string> sources, IEnumerable<(string name, byte[] body)> refs, CancellationToken cancellationToken = default)
Parameters
name
stringThe name of the compilation unit.
sources
IEnumerable<string>The source code files as strings.
refs
IEnumerable<(string name, byte[] body)>A collection of references as tuples containing the name and binary content.
cancellationToken
CancellationTokenA token to monitor for cancellation requests.
Returns
- Task<CompilationResult>
A task that represents the asynchronous compile operation. The task result contains a CompilationResult.
CreateContext()
Creates a new compiler context.
ICompilerContext CreateContext()
Returns
- ICompilerContext
A new instance of ICompilerContext.