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

Unified Diff: pkg/analyzer/lib/src/dart/analysis/ast_provider_context.dart

Issue 2669353002: Stop using Element.computeNode() in refactorings and fixes. (Closed)
Patch Set: documentation comments Created 3 years, 11 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
Index: pkg/analyzer/lib/src/dart/analysis/ast_provider_context.dart
diff --git a/pkg/analyzer/lib/src/dart/analysis/ast_provider_context.dart b/pkg/analyzer/lib/src/dart/analysis/ast_provider_context.dart
new file mode 100644
index 0000000000000000000000000000000000000000..b53334eb046ce0f5d783235a9d5c260f82c926c6
--- /dev/null
+++ b/pkg/analyzer/lib/src/dart/analysis/ast_provider_context.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2017, 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.
+
+import 'dart:async';
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/analysis/ast_provider_driver.dart';
+import 'package:analyzer/src/dart/element/ast_provider.dart';
+import 'package:analyzer/src/generated/engine.dart';
+
+/**
+ * [AstProvider] implementation for [AnalysisContext].
+ */
+class AstProviderForContext extends AbstractAstProvider {
+ final AnalysisContext context;
+
+ AstProviderForContext(this.context);
+
+ @override
+ Future<CompilationUnit> getParsedUnitForElement(Element element) async {
+ return context.parseCompilationUnit(element.source);
+ }
+
+ @override
+ Future<CompilationUnit> getResolvedUnitForElement(Element element) async {
+ return context.getResolvedCompilationUnit2(
+ element.source, element.librarySource);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698