private static async Task <DfirRoot> GenerateDfirAsync(
            ICompositionHost host,
            Envoy documentEnvoy,
            ProgressToken progressToken,
            CompileCancellationToken compileCancellationToken)
        {
            ExtendedQualifiedName topLevelDocumentName = documentEnvoy.CreateExtendedQualifiedName();
            TargetCompiler        targetCompiler       = documentEnvoy.QueryInheritedService <ITargetCompilerServices>().First().Compiler;
            AnyMocCompiler        compiler             = host.GetSharedExportedValue <AnyMocCompiler>();
            IReadOnlySymbolTable  symbolTable          = documentEnvoy.ComputeSymbolTable();

            // A specAndQName is used by the compiler to identify the document for which we're asking for DFIR.
            var specAndQName = new SpecAndQName(targetCompiler.CreateDefaultBuildSpec(topLevelDocumentName, symbolTable), topLevelDocumentName);

            try
            {
                DfirRoot sourceDfirRoot = await compiler.GetTargetDfirAsync(specAndQName, compileCancellationToken, progressToken);

                if (sourceDfirRoot == null)
                {
                    await ShowErrorMessageBoxAsync(host, WaitForCompileErrorMessageBoxText);
                }

                return(sourceDfirRoot);
            }
            catch
            {
                await ShowErrorMessageBoxAsync(host, DfirGenerationErrorMessageBoxText);

                return(null);
            }
        }
Beispiel #2
0
 public override DfirRootRuntimeType GetRuntimeType(IReadOnlySymbolTable symbolTable) => FunctionRuntimeType;
Beispiel #3
0
 /// <inheritdoc/>
 public override BuildSpec CreateDefaultBuildSpec(ExtendedQualifiedName topLevelSourceModelName, IReadOnlySymbolTable symbolTable)
 {
     Log.Assert(0xC3B662C7U, topLevelSourceModelName.ComponentName != null, "Component name must be set in ExtendedQualifiedNames passed to compiler");
     return(new BuildSpec(topLevelSourceModelName, ComponentTypeIdentifier.ObjFile, symbolTable, this, topLevelSourceModelName));
 }
Beispiel #4
0
 /// <inheritdoc/>
 public override BuildSpec CreateDefaultBuildSpec(CompilableDefinitionName topLevelDefinitionName, IReadOnlySymbolTable symbolTable)
 {
     Log.Assert(0xC3B662C7U, topLevelDefinitionName.OwningComponentRuntimeName != null, "Component name must be set in ExtendedQualifiedNames passed to compiler");
     return(new BuildSpec(TargetCompilerIdentity, symbolTable));
 }
Beispiel #5
0
 public override DfirRootRuntimeType GetRuntimeType(IReadOnlySymbolTable symbolTable) => TypeDiagramRuntimeType;