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

Unified Diff: pkg/analyzer/test/generated/simple_resolver_test.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/analyzer/test/generated/simple_resolver_test.dart
diff --git a/pkg/analyzer/test/generated/simple_resolver_test.dart b/pkg/analyzer/test/generated/simple_resolver_test.dart
index 4df27be8f512b624d5f9ef51892996bc9bf62b9b..620bc1f35b1cd9ed9b0a951260789102e50ead29 100644
--- a/pkg/analyzer/test/generated/simple_resolver_test.dart
+++ b/pkg/analyzer/test/generated/simple_resolver_test.dart
@@ -5,6 +5,7 @@
library analyzer.test.generated.simple_resolver_test;
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
@@ -748,7 +749,12 @@ class C extends B with M1, M2 {
ExpressionStatement stmt = body.block.statements[0];
AssignmentExpression assignment = stmt.expression;
SimpleIdentifier leftHandSide = assignment.leftHandSide;
- expect(leftHandSide.staticElement.enclosingElement.name, 'M2');
+ expect(
+ resolutionMap
+ .staticElementForIdentifier(leftHandSide)
+ .enclosingElement
+ .name,
+ 'M2');
expect(leftHandSide.auxiliaryElements.staticElement.enclosingElement.name,
'M2');
}
@@ -785,7 +791,11 @@ void main() {
AssignmentExpression assignment = stmt.expression;
PropertyAccess propertyAccess = assignment.leftHandSide;
expect(
- propertyAccess.propertyName.staticElement.enclosingElement.name, 'M2');
+ resolutionMap
+ .staticElementForIdentifier(propertyAccess.propertyName)
+ .enclosingElement
+ .name,
+ 'M2');
expect(
propertyAccess
.propertyName.auxiliaryElements.staticElement.enclosingElement.name,
@@ -817,7 +827,8 @@ class C extends B with M1, M2 {
BlockFunctionBody body = f.body;
ReturnStatement stmt = body.block.statements[0];
SimpleIdentifier x = stmt.expression;
- expect(x.staticElement.enclosingElement.name, 'M2');
+ expect(resolutionMap.staticElementForIdentifier(x).enclosingElement.name,
+ 'M2');
}
void test_getter_fromMixins_property_access() {
@@ -845,7 +856,11 @@ void main() {
VariableDeclarationStatement stmt = body.block.statements[0];
PropertyAccess propertyAccess = stmt.variables.variables[0].initializer;
expect(
- propertyAccess.propertyName.staticElement.enclosingElement.name, 'M2');
+ resolutionMap
+ .staticElementForIdentifier(propertyAccess.propertyName)
+ .enclosingElement
+ .name,
+ 'M2');
}
void test_getterAndSetterWithDifferentTypes() {
@@ -1535,7 +1550,12 @@ void main() {
BlockFunctionBody body = main.functionExpression.body;
ExpressionStatement stmt = body.block.statements[0];
MethodInvocation expr = stmt.expression;
- expect(expr.methodName.staticElement.enclosingElement.name, 'M2');
+ expect(
+ resolutionMap
+ .staticElementForIdentifier(expr.methodName)
+ .enclosingElement
+ .name,
+ 'M2');
}
void test_method_fromMixins_bare_identifier() {
@@ -1563,7 +1583,12 @@ class C extends B with M1, M2 {
ExpressionStatement stmt = body.block.statements[0];
MethodInvocation invocation = stmt.expression;
SimpleIdentifier methodName = invocation.methodName;
- expect(methodName.staticElement.enclosingElement.name, 'M2');
+ expect(
+ resolutionMap
+ .staticElementForIdentifier(methodName)
+ .enclosingElement
+ .name,
+ 'M2');
}
void test_method_fromMixins_invked_from_outside_class() {
@@ -1590,7 +1615,12 @@ void main() {
BlockFunctionBody body = main.functionExpression.body;
ExpressionStatement stmt = body.block.statements[0];
MethodInvocation invocation = stmt.expression;
- expect(invocation.methodName.staticElement.enclosingElement.name, 'M2');
+ expect(
+ resolutionMap
+ .staticElementForIdentifier(invocation.methodName)
+ .enclosingElement
+ .name,
+ 'M2');
}
void test_method_fromSuperclassMixin() {
@@ -1680,7 +1710,12 @@ class C extends B with M1, M2 {
ExpressionStatement stmt = body.block.statements[0];
AssignmentExpression assignment = stmt.expression;
SimpleIdentifier leftHandSide = assignment.leftHandSide;
- expect(leftHandSide.staticElement.enclosingElement.name, 'M2');
+ expect(
+ resolutionMap
+ .staticElementForIdentifier(leftHandSide)
+ .enclosingElement
+ .name,
+ 'M2');
}
void test_setter_fromMixins_property_access() {
@@ -1709,7 +1744,11 @@ void main() {
AssignmentExpression assignment = stmt.expression;
PropertyAccess propertyAccess = assignment.leftHandSide;
expect(
- propertyAccess.propertyName.staticElement.enclosingElement.name, 'M2');
+ resolutionMap
+ .staticElementForIdentifier(propertyAccess.propertyName)
+ .enclosingElement
+ .name,
+ 'M2');
}
void test_setter_inherited() {

Powered by Google App Engine
This is Rietveld 408576698