/// <nodoc/> public SemanticWorkspaceProvider(IWorkspaceStatistics statistics, WorkspaceConfiguration workspaceConfiguration) { Contract.Requires(statistics != null); Contract.Requires(workspaceConfiguration != null); m_statistics = statistics; m_workspaceConfiguration = workspaceConfiguration; }
/// <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) { }
/// <summary> /// Checks all specs in a workspace for non-interactive scenarios, typically regular BuildXL invocation. /// </summary> /// TODO: Consider exposing an AbsolutePath as part of ISourceFile. We are doing to many conversions back and forth between string and AbsolutePath /// This class is an example of this, but there are other cases. public static ITypeChecker Check(PathTable pathTable, Workspace workspace, IWorkspaceStatistics stats, int degreeOfParallelism) { var checker = Create( pathTable, workspace, stats, degreeOfParallelism, nextMergeId: 0, nextNodeId: 0, nextSymbolId: 0, interactiveMode: false); // Triggering the analysis. checker.GetDiagnostics(); return(checker); }
/// <summary> /// Creates a typechecker without checking all the specs (used by langauge service). /// </summary> public static ITypeChecker Create(PathTable pathTable, Workspace workspace, IWorkspaceStatistics stats, int degreeOfParallelism, int nextMergeId = 0, int nextNodeId = 0, int nextSymbolId = 0, bool interactiveMode = true) { // When in incremental mode (which is used by the IDE) then we want the "produce diagnostics" flag to be off. // The "produce diagnostic" flag is used to report syntax errors that may be present in the script. // One behavior difference of the type checker is that when produce diagnostics is false, the type checker // will return contextual types for things such as an object literal expression in a function call EVEN IF // the object literal expression cannot be assigned to the argument\parameter type of a call expression. var checker = Checker.CreateTypeChecker( new WorkspaceTypeCheckerHost(pathTable, workspace, stats), produceDiagnostics: true, degreeOfParallelism: degreeOfParallelism, trackFileToFileDependencies: workspace.TrackFileToFileDependencies, interactiveMode: interactiveMode, nextMergeId: nextMergeId, nextNodeId: nextNodeId, nextSymbolId: nextSymbolId); return(checker); }
/// <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; }
/// <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); }
/// <nodoc/> public WorkspaceTypeCheckerHost(PathTable pathTable, Workspace workspace, IWorkspaceStatistics stats) { m_pathTable = pathTable; m_workspace = workspace; m_stats = stats; }
/// <nodoc /> public WorkspaceProviderStatisticsDecorator(IWorkspaceStatistics statistics, IWorkspaceProvider decoratee) { m_statistics = statistics; m_decoratee = decoratee; }