Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: pkg/analysis_testing/lib/abstract_context.dart

Issue 533243002: Merge analysis_testing package into analysis_server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_testing/LICENSE ('k') | pkg/analysis_testing/lib/abstract_single_unit.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_testing/lib/abstract_context.dart
diff --git a/pkg/analysis_testing/lib/abstract_context.dart b/pkg/analysis_testing/lib/abstract_context.dart
deleted file mode 100644
index 340c10f97a544bebac046152785eee7421804e38..0000000000000000000000000000000000000000
--- a/pkg/analysis_testing/lib/abstract_context.dart
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library testing.abstract_context;
-
-import 'package:analysis_testing/mock_sdk.dart';
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/file_system/memory_file_system.dart';
-import 'package:analyzer/src/generated/ast.dart';
-import 'package:analyzer/src/generated/element.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/sdk.dart';
-import 'package:analyzer/src/generated/source_io.dart';
-
-
-/**
- * Finds an [Element] with the given [name].
- */
-Element findChildElement(Element root, String name, [ElementKind kind]) {
- Element result = null;
- root.accept(new _ElementVisitorFunctionWrapper((Element element) {
- if (element.name != name) {
- return;
- }
- if (kind != null && element.kind != kind) {
- return;
- }
- result = element;
- }));
- return result;
-}
-
-
-/**
- * A function to be called for every [Element].
- */
-typedef void _ElementVisitorFunction(Element element);
-
-
-class AbstractContextTest {
- static final DartSdk SDK = new MockSdk();
- static final UriResolver SDK_RESOLVER = new DartUriResolver(SDK);
-
- MemoryResourceProvider provider = new MemoryResourceProvider();
- UriResolver resourceResolver;
- AnalysisContext context;
-
- Source addSource(String path, String content) {
- File file = provider.newFile(path, content);
- Source source = file.createSource();
- ChangeSet changeSet = new ChangeSet();
- changeSet.addedSource(source);
- context.applyChanges(changeSet);
- context.setContents(source, content);
- return source;
- }
-
- /**
- * Performs all analysis tasks in [context].
- */
- void performAllAnalysisTasks() {
- while (true) {
- AnalysisResult result = context.performAnalysisTask();
- if (!result.hasMoreWork) {
- break;
- }
- }
- }
-
- CompilationUnit resolveDartUnit(Source unitSource, Source librarySource) {
- return context.resolveCompilationUnit2(unitSource, librarySource);
- }
-
- CompilationUnit resolveLibraryUnit(Source source) {
- return context.resolveCompilationUnit2(source, source);
- }
-
- void setUp() {
- resourceResolver = new ResourceUriResolver(provider);
- context = AnalysisEngine.instance.createAnalysisContext();
- context.sourceFactory = new SourceFactory([SDK_RESOLVER, resourceResolver]);
- }
-
- void tearDown() {
- context = null;
- provider = null;
- }
-}
-
-
-/**
- * Wraps the given [_ElementVisitorFunction] into an instance of
- * [engine.GeneralizingElementVisitor].
- */
-class _ElementVisitorFunctionWrapper extends GeneralizingElementVisitor {
- final _ElementVisitorFunction function;
- _ElementVisitorFunctionWrapper(this.function);
- visitElement(Element element) {
- function(element);
- super.visitElement(element);
- }
-}
« no previous file with comments | « pkg/analysis_testing/LICENSE ('k') | pkg/analysis_testing/lib/abstract_single_unit.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698