Index: pkg/analyzer/test/src/task/incremental_element_builder_test.dart |
diff --git a/pkg/analyzer/test/src/task/incremental_element_builder_test.dart b/pkg/analyzer/test/src/task/incremental_element_builder_test.dart |
index 05c7a76a3c251e60ebc068c841f2d63f9d8230a1..05b08078e9babba454f008b63beed48568873129 100644 |
--- a/pkg/analyzer/test/src/task/incremental_element_builder_test.dart |
+++ b/pkg/analyzer/test/src/task/incremental_element_builder_test.dart |
@@ -5,6 +5,7 @@ |
library analyzer.test.src.task.incremental_element_builder_test; |
import 'package:analyzer/dart/ast/ast.dart'; |
+import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
import 'package:analyzer/dart/element/element.dart'; |
import 'package:analyzer/dart/element/visitor.dart'; |
import 'package:analyzer/src/dart/ast/utilities.dart'; |
@@ -1244,7 +1245,9 @@ class A {} |
// Set the LibraryElement and check that its nameOffset is correct. |
libraryDirective.element = |
new LibraryElementImpl.forNode(context, libraryDirective.name); |
- expect(libraryDirective.element.nameOffset, libraryDirective.name.offset); |
+ expect( |
+ resolutionMap.elementDeclaredByDirective(libraryDirective).nameOffset, |
+ libraryDirective.name.offset); |
// Update and check again that the nameOffset is correct. |
_buildNewUnit(r''' |
#!/bin/sh |
@@ -1252,7 +1255,9 @@ class A {} |
library my_lib; |
class A {} |
'''); |
- expect(libraryDirective.element.nameOffset, libraryDirective.name.offset); |
+ expect( |
+ resolutionMap.elementDeclaredByDirective(libraryDirective).nameOffset, |
+ libraryDirective.name.offset); |
} |
test_directives_remove() { |
@@ -1350,8 +1355,10 @@ import 'test2.dart' as m; |
class A {} |
'''); |
int expectedPrefixOffset = 23; |
- expect(import1.prefix.staticElement.nameOffset, expectedPrefixOffset); |
- expect(import2.prefix.staticElement.nameOffset, expectedPrefixOffset); |
+ expect(resolutionMap.staticElementForIdentifier(import1.prefix).nameOffset, |
+ expectedPrefixOffset); |
+ expect(resolutionMap.staticElementForIdentifier(import2.prefix).nameOffset, |
+ expectedPrefixOffset); |
expect(importElement1.prefix.nameOffset, expectedPrefixOffset); |
expect(importElement2.prefix.nameOffset, expectedPrefixOffset); |
} |
@@ -1528,7 +1535,11 @@ class C {}'''); |
{ |
var docReferences = newNode.documentationComment.references; |
expect(docReferences, hasLength(2)); |
- expect(docReferences[0].identifier.staticElement.name, 'double'); |
+ expect( |
+ resolutionMap |
+ .staticElementForIdentifier(docReferences[0].identifier) |
+ .name, |
+ 'double'); |
expect(docReferences[1].identifier.staticElement, |
same(newNodes[2].element)); |
} |
@@ -1549,7 +1560,11 @@ class A {}'''); |
{ |
var docReferences = newNode.documentationComment.references; |
expect(docReferences, hasLength(1)); |
- expect(docReferences[0].identifier.staticElement.name, 'bool'); |
+ expect( |
+ resolutionMap |
+ .staticElementForIdentifier(docReferences[0].identifier) |
+ .name, |
+ 'bool'); |
} |
} |
{ |
@@ -1568,7 +1583,11 @@ class B {}'''); |
{ |
var docReferences = newNode.documentationComment.references; |
expect(docReferences, hasLength(1)); |
- expect(docReferences[0].identifier.staticElement.name, 'int'); |
+ expect( |
+ resolutionMap |
+ .staticElementForIdentifier(docReferences[0].identifier) |
+ .name, |
+ 'int'); |
} |
} |
// verify delta |
@@ -2206,8 +2225,9 @@ class _BuiltElementsValidator extends AstComparator { |
AstNode parent = actual.parent; |
if (parent is Declaration) { |
ElementAnnotationImpl actualElement = actual.elementAnnotation; |
- CompilationUnitElement enclosingUnitElement = |
- parent.element.getAncestor((a) => a is CompilationUnitElement); |
+ CompilationUnitElement enclosingUnitElement = resolutionMap |
+ .elementDeclaredByDeclaration(parent) |
+ .getAncestor((a) => a is CompilationUnitElement); |
expect(actualElement.compilationUnit, same(enclosingUnitElement)); |
} |
} |