Пример #1
0
        private static ExpressionAnalysis AnalyzeExpression(int location, string sourceCode)
        {
            if (location < 0)
            {
                location = sourceCode.Length + location;
            }

            var analyzer = new PythonAnalyzer(new MockDlrRuntimeHost(), new MockErrorProviderFactory());
            var buffer   = new MockTextBuffer(sourceCode);
            var textView = new MockTextView(buffer);
            var item     = analyzer.AnalyzeTextView(textView);

            while (item.IsAnalyzed)
            {
                Thread.Sleep(100);
            }

            var snapshot = (MockTextSnapshot)buffer.CurrentSnapshot;

            return(analyzer.AnalyzeExpression(snapshot, buffer, new MockTrackingSpan(snapshot, location, 0)));
        }
Пример #2
0
        private static ExpressionAnalysis AnalyzeExpression(int location, string sourceCode)
        {
            if (location < 0) {
                location = sourceCode.Length + location;
            }

            var analyzer = new PythonAnalyzer(new MockDlrRuntimeHost(), new MockErrorProviderFactory());
            var buffer = new MockTextBuffer(sourceCode);
            var textView = new MockTextView(buffer);
            var item = analyzer.AnalyzeTextView(textView);
            while (item.IsAnalyzed) {
                Thread.Sleep(100);
            }

            var snapshot = (MockTextSnapshot)buffer.CurrentSnapshot;

            return analyzer.AnalyzeExpression(snapshot, buffer, new MockTrackingSpan(snapshot, location, 0));
        }