Esempio n. 1
0
 /// <summary>
 /// Creates a new WorkspaceProvider using a <see cref="ModuleReferenceResolver"/> to identify DScript module references
 /// </summary>
 public WorkspaceProvider(
     IWorkspaceStatistics workspaceStatistics,
     List <IWorkspaceModuleResolver> resolvers,
     WorkspaceConfiguration configuration,
     PathTable pathTable,
     SymbolTable symbolTable)
     : this(workspaceStatistics, resolvers, new ModuleReferenceResolver(pathTable), configuration, pathTable, symbolTable)
 {
 }
Esempio n. 2
0
        /// <nodoc/>
        public WorkspaceProvider(
            IWorkspaceStatistics workspaceStatistics,
            List <IWorkspaceModuleResolver> resolvers,
            IModuleReferenceResolver moduleReferenceResolver,
            WorkspaceConfiguration configuration,
            PathTable pathTable,
            SymbolTable symbolTable)
        {
            Contract.Requires(workspaceStatistics != null);
            Contract.Requires(configuration != null);
            Contract.Requires(moduleReferenceResolver != null);
            Contract.Requires(pathTable != null);

            Statistics = workspaceStatistics;
            m_moduleReferenceResolver = moduleReferenceResolver;
            PathTable     = pathTable;
            Configuration = configuration;
            SymbolTable   = symbolTable;
            m_resolvers   = resolvers;
        }
Esempio n. 3
0
        /// <nodoc/>
        public static bool TryCreate(
            [CanBeNull] Workspace mainConfigurationWorkspace,
            IWorkspaceStatistics workspaceStatistics,
            FrontEndFactory frontEndFactory,
            PathTable pathTable,
            SymbolTable symbolTable,
            WorkspaceConfiguration configuration,
            bool useDecorator,
            bool addBuiltInPreludeResolver,
            out IWorkspaceProvider workspaceProvider,
            out IEnumerable <Failure> failures)
        {
            // mainConfigurationWorkspace can be null for some tests
            var mainFile = mainConfigurationWorkspace != null ?
                           mainConfigurationWorkspace.ConfigurationModule.Definition.MainFile :
                           AbsolutePath.Invalid;

            if (!TryCreateResolvers(
                    frontEndFactory,
                    configuration,
                    pathTable,
                    mainFile,
                    addBuiltInPreludeResolver,
                    out var resolvers,
                    out failures))
            {
                workspaceProvider = default(IWorkspaceProvider);
                return(false);
            }

            var provider = new WorkspaceProvider(workspaceStatistics, resolvers, configuration, pathTable, symbolTable);

            provider.m_mainConfigurationWorkspace = mainConfigurationWorkspace;

            workspaceProvider = useDecorator
                ? (IWorkspaceProvider) new WorkspaceProviderStatisticsDecorator(workspaceStatistics, provider)
                : provider;
            return(true);
        }
Esempio n. 4
0
 /// <inheritdoc />
 public TestWorkspaceFiltering()
 {
     m_symbolTable = new SymbolTable(m_pathTable.StringTable);
 }
Esempio n. 5
0
 /// <summary>
 /// Attempts to get the full symbol of the combined symbols. If this value represents a full symbol
 /// it is returned unmodified.
 /// </summary>
 public bool TryGetFullSymbol(SymbolTable symbolTable, FullSymbol root, out FullSymbol fullSymbol)
 {
     fullSymbol = this;
     return(true);
 }
Esempio n. 6
0
 public FullSymbol Combine(SymbolTable table, FullSymbol symbol)
 {
     Contract.Requires(table != null, "table != null");
     return(!symbol.IsValid ? this : Combine(table, symbol.GetParent(table)).Combine(table, symbol.GetName(table)));
 }
Esempio n. 7
0
 /// <summary>
 /// Converts the symbol to its string representation
 /// </summary>
 public string ToString(SymbolTable symbolTable)
 {
     return(ToString(symbolTable.StringTable));
 }
Esempio n. 8
0
 /// <summary>
 /// Attempts to get the full symbol of the combined symbols. If this value represents a full symbol
 /// it is returned unmodified.
 /// </summary>
 public bool TryGetFullSymbol(SymbolTable symbolTable, FullSymbol root, out FullSymbol fullSymbol)
 {
     return(root.TryGet(symbolTable, this, out fullSymbol));
 }
Esempio n. 9
0
 /// <summary>
 /// Appends a string representation of <paramref name="fullSymbol"/> into <paramref name="builder"/>.
 /// </summary>
 public static void Append(this StringBuilder builder, FullSymbol fullSymbol, SymbolTable symbolTable)
 {
     builder.Append(fullSymbol.ToStringAsCharArray(symbolTable));
 }