References.CombineSyntaxTrees Method

Definition

Combines the syntax trees loaded from different source assemblies into a single syntax tree.

public static bool CombineSyntaxTrees (out System.Collections.Immutable.ImmutableArray<Microsoft.Quantum.QsCompiler.SyntaxTree.QsNamespace> combined, int additionalAssemblies = 0, Action<Microsoft.Quantum.QsCompiler.Diagnostics.ErrorCode,string[]>? onError = default, params (string, System.Collections.Immutable.ImmutableArray<Microsoft.Quantum.QsCompiler.SyntaxTree.QsNamespace>)[] loaded);
static member CombineSyntaxTrees : ImmutableArray * int * Action<Microsoft.Quantum.QsCompiler.Diagnostics.ErrorCode, string[]> * ValueTuple<string, System.Collections.Immutable.ImmutableArray<Microsoft.Quantum.QsCompiler.SyntaxTree.QsNamespace>>[] -> bool
Public Shared Function CombineSyntaxTrees (ByRef combined As ImmutableArray(Of QsNamespace), Optional additionalAssemblies As Integer = 0, Optional onError As Action(Of ErrorCode, String()) = Nothing, ParamArray loaded As ValueTuple(Of String, ImmutableArray(Of QsNamespace))()) As Boolean

Parameters

combined
ImmutableArray<QsNamespace>

The resulting combined syntax tree, or an empty array of namespaces on failure.

additionalAssemblies
Int32

The number of additional assemblies included in the compilation besides the loaded assemblies.

onError
Action<ErrorCode,String[]>

Invoked on the error messages generated when the given syntax trees contain conflicting declarations.

loaded
ValueTuple<String,ImmutableArray<QsNamespace>>[]

A parameter array of tuples containing the syntax trees to combine as well as the sources from which they were loaded.

Returns

Boolean

True if the syntax trees in loaded do not contain any conflicting declarations and were successfully combined. False otherwise.

Remarks

The first tuple item in loaded is expected to contain the id of the source from which the syntax tree was loaded, and the second is expected to contain the loaded syntax tree.

The source file of a declaration in combined will be set to the specified source from which it was loaded, and internal declarations as well as their usages will be renamed to avoid conflicts.

Applies to