ICompiler

Ecng.Compilation

Defines the contract for a compiler that supports compiling source files into an assembly.

Properties

Extension
public string Extension { get; }
value = iCompiler.Extension

Gets the file extension used by the compiler.

IsAssemblyPersistable
public bool IsAssemblyPersistable { get; }
value = iCompiler.IsAssemblyPersistable

Gets a value indicating whether the compiled assembly can be persisted.

IsCaseSensitive
public bool IsCaseSensitive { get; }
value = iCompiler.IsCaseSensitive

Gets a value indicating whether the language is case sensitive.

IsReferencesSupported
public bool IsReferencesSupported { get; }
value = iCompiler.IsReferencesSupported

Gets a value indicating whether the compiler supports external references.

IsTabsSupported
public bool IsTabsSupported { get; }
value = iCompiler.IsTabsSupported

Gets a value indicating whether the compiler supports tabs in the source code.

Methods

Analyse
public Task<CompilationError[]> Analyse(object analyzer, IEnumerable<object> analyzerSettings, string name, IEnumerable<string> sources, IEnumerable<ValueTuple<string, byte[]>> refs, CancellationToken cancellationToken)
result = iCompiler.Analyse(analyzer, analyzerSettings, name, sources, refs, cancellationToken)

Analyzes the provided source code using the specified analyzer and settings.

analyzer
The analyzer used to perform the analysis.
analyzerSettings
The settings applied to the analyzer.
name
The name of the compilation unit.
sources
The source code files as strings.
refs
A collection of references as tuples containing the name and binary content.
cancellationToken
A token to monitor for cancellation requests.

Returns: A task that represents the asynchronous analysis operation. The task result contains an array of CompilationError instances.

Compile
public Task<CompilationResult> Compile(string name, IEnumerable<string> sources, IEnumerable<ValueTuple<string, byte[]>> refs, CancellationToken cancellationToken)
result = iCompiler.Compile(name, sources, refs, cancellationToken)

Compiles the provided source code files with the specified references.

name
The name of the compilation unit.
sources
The source code files as strings.
refs
A collection of references as tuples containing the name and binary content.
cancellationToken
A token to monitor for cancellation requests.

Returns: A task that represents the asynchronous compile operation. The task result contains a CompilationResult.

CreateContext
public ICompilerContext CreateContext()
result = iCompiler.CreateContext()

Creates a new compiler context.

Returns: A new instance of ICompilerContext.