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

Unified Diff: pkg/analysis_server/lib/src/services/refactoring/extract_method.dart

Issue 2551023005: Prepare for decoupling analyzer ASTs from element model. (Closed)
Patch Set: Address review comments Created 4 years 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/analysis_server/lib/src/services/refactoring/extract_method.dart
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
index 107abf3d74f6ee955c2be1ef2056439a7fdeeb20..366f282a8aab0b8c235cc797722e7b8dba79fe3c 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
@@ -21,6 +21,7 @@ import 'package:analysis_server/src/services/refactoring/rename_unit_member.dart
import 'package:analysis_server/src/services/search/element_visitors.dart';
import 'package:analysis_server/src/services/search/search_engine.dart';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
@@ -411,7 +412,8 @@ class ExtractMethodRefactoringImpl extends RefactoringImpl
AstNode parent = _parentMember.parent;
// top-level function
if (parent is CompilationUnit) {
- LibraryElement libraryElement = parent.element.library;
+ LibraryElement libraryElement =
+ resolutionMap.elementForCompilationUnit(parent).library;
return validateCreateFunction(searchEngine, libraryElement, name);
}
// method of class

Powered by Google App Engine
This is Rietveld 408576698