Ejemplo n.º 1
0
        /// <summary>
        /// Creates a module definition for configuration file.
        /// </summary>
        public static ModuleDefinition CreateConfigModuleDefinition(PathTable pathTable, AbsolutePath configPath, IEnumerable <AbsolutePath> allSpecs)
        {
            Contract.Requires(pathTable != null);
            Contract.Requires(configPath.IsValid);
            Contract.Requires(allSpecs != null);

            var descriptorName = Names.ConfigModuleName;
            var id             = StringId.Create(pathTable.StringTable, descriptorName);
            var mdsc           = new ModuleDescriptor(
                id: new ModuleId(id.Value, friendlyNameForDebugging: descriptorName),
                name: descriptorName,
                displayName: descriptorName,
                version: "0.0",
                resolverKind: KnownResolverKind.DScriptResolverKind,
                resolverName: "DScriptConfiguration");

            return(ModuleDefinition.CreateModuleDefinitionWithExplicitReferencesWithEmptyQualifierSpace(
                       descriptor: mdsc,
                       main: configPath,
                       moduleConfigFile: AbsolutePath.Invalid,
                       specs: allSpecs,
                       pathTable: pathTable));
        }
Ejemplo n.º 2
0
 /// <nodoc/>
 public ParsedModule GetModuleByModuleDescriptor(ModuleDescriptor moduleDescriptor)
 {
     return(m_allModulesByDescriptor[moduleDescriptor]);
 }
Ejemplo n.º 3
0
 /// <nodoc/>
 public bool TryGetModuleByModuleDescriptor(ModuleDescriptor moduleDescriptor, out ParsedModule parsedModule)
 {
     return(m_allModulesByDescriptor.TryGetValue(moduleDescriptor, out parsedModule));
 }
Ejemplo n.º 4
0
 /// <nodoc/>
 public ResolverNotFoundForModuleDescriptorFailure(List <IWorkspaceModuleResolver> knownResolvers, ModuleDescriptor moduleDescriptor)
     : base(knownResolvers)
 {
     m_moduleDescriptor = moduleDescriptor;
 }
Ejemplo n.º 5
0
        private Possible <IWorkspaceModuleResolver> GetOrFindModuleResolver(AbsolutePath pathToSpec, ModuleDescriptor descriptor)
        {
            if (!m_moduleResolvers.TryGetValue(descriptor, out Possible <IWorkspaceModuleResolver> result))
            {
                result = m_workspaceProvider.FindResolverAsync(pathToSpec).GetAwaiter().GetResult();
                m_moduleResolvers.TryAdd(descriptor, result);
            }

            return(result);
        }
Ejemplo n.º 6
0
 /// <nodoc />
 public DisallowedModuleReferenceFailure(ModuleDescriptor descriptor, ISourceFile sourceFile, IEnumerable <Diagnostic> disallowedReferences)
     : base(descriptor, sourceFile)
 {
     m_diagnostics = sourceFile.ParseDiagnostics.Union(disallowedReferences).ToList();
 }