示例#1
0
        /// <nodoc />
        protected void BindSourceFile(ParsedSpecWithOwningModule parsedSpecWithOwningModule)
        {
            var sourceFile = parsedSpecWithOwningModule.ParsedFile;

            // Don't need to bind if the file is already bound (incremental case)
            if (sourceFile.State == SourceFileState.Bound)
            {
                return;
            }

            var specPathString = parsedSpecWithOwningModule.ParsedFile.Path.AbsolutePath;

            using (m_workspaceProvider.Statistics.SpecBinding.Start(specPathString))
            {
                Binder.Bind(sourceFile, CompilerOptions.Empty);
                m_workspaceProvider.Statistics.SourceFileSymbols.Increment(sourceFile.SymbolCount, specPathString);
            }

            // Once binding is done, we can compute the binding fingerprint,
            // that is required for filtered scenarios.
            if (sourceFile.ParseDiagnostics.Count == 0 && sourceFile.BindDiagnostics.Count == 0 && m_workspaceConfiguration.ConstructFingerprintDuringParsing)
            {
                using (m_workspaceProvider.Statistics.SpecComputeFingerprint.Start())
                {
                    sourceFile.ComputeBindingFingerprint(m_workspaceProvider.SymbolTable);
                }
            }
        }
示例#2
0
        private void ScheduleSourceFileBinding(ParsedSpecWithOwningModule parsedSpecWithOwningModule)
        {
            var parsedFile = parsedSpecWithOwningModule.ParsedFile;

            // We can safely schedule binding for the spec.
            // Don't need to bind if parse errors are present and we cancel on failure.
            if (parsedFile.ParseDiagnostics.Count == 0 || !m_queueOptions.CancelOnFirstFailure)
            {
                m_bindQueue.Post(parsedSpecWithOwningModule);
            }
        }
示例#3
0
        private void ProcessQueueItemForBinding(ParsedSpecWithOwningModule parsedSpecWithOwningModule)
        {
            BindSourceFile(parsedSpecWithOwningModule);

            var parsedFile = parsedSpecWithOwningModule.ParsedFile;

            if (parsedFile.BindDiagnostics.Count != 0)
            {
                ReportFailureAndCancelParsingIfNeeded(
                    new BindingFailure(parsedSpecWithOwningModule.OwningModule.Descriptor, parsedFile));
            }
        }