Esempio n. 1
0
 public EmitterContext(SemanticModel semanticModel)
 {
     this.SemanticModel        = semanticModel;
     this.DataFlowAnalyzer     = new(semanticModel);
     this.VariablesToInline    = InlineDependencyVisitor.GetVariablesToInline(semanticModel);
     this.ResourceDependencies = ResourceDependencyVisitor.GetResourceDependencies(semanticModel);
 }
Esempio n. 2
0
 public EmitterContext(SemanticModel semanticModel, EmitterSettings settings)
 {
     Settings             = settings;
     SemanticModel        = semanticModel;
     DataFlowAnalyzer     = new(semanticModel);
     VariablesToInline    = InlineDependencyVisitor.GetVariablesToInline(semanticModel);
     ResourceDependencies = ResourceDependencyVisitor.GetResourceDependencies(semanticModel);
     FunctionVariables    = FunctionVariableGeneratorVisitor.GetFunctionVariables(semanticModel).ToImmutableDictionary();
 }
Esempio n. 3
0
        public static ImmutableDictionary <DeclaredSymbol, ImmutableHashSet <ResourceDependency> > GetResourceDependencies(SemanticModel model)
        {
            var visitor = new ResourceDependencyVisitor(model);

            visitor.Visit(model.Root.Syntax);

            var output = new Dictionary <DeclaredSymbol, ImmutableHashSet <ResourceDependency> >();

            foreach (var kvp in visitor.resourceDependencies)
            {
                if (kvp.Key is ResourceSymbol || kvp.Key is ModuleSymbol)
                {
                    output[kvp.Key] = OptimizeDependencies(kvp.Value);
                }
            }
            return(output.ToImmutableDictionary());
        }
Esempio n. 4
0
        public static ImmutableDictionary <ResourceSymbol, ImmutableHashSet <ResourceSymbol> > GetResourceDependencies(SemanticModel.SemanticModel model)
        {
            var visitor = new ResourceDependencyVisitor(model);

            visitor.Visit(model.Root.Syntax);

            var output = new Dictionary <ResourceSymbol, ImmutableHashSet <ResourceSymbol> >();

            foreach (var kvp in visitor.resourceDependencies)
            {
                if (kvp.Key is ResourceSymbol resourceSymbol)
                {
                    output[resourceSymbol] = kvp.Value.ToImmutableHashSet();
                }
            }
            return(output.ToImmutableDictionary());
        }