OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library analyzer.test.src.task.incremental_element_builder_test; | 5 library analyzer.test.src.task.incremental_element_builder_test; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
9 import 'package:analyzer/dart/element/visitor.dart'; | 9 import 'package:analyzer/dart/element/visitor.dart'; |
10 import 'package:analyzer/src/dart/ast/utilities.dart'; | 10 import 'package:analyzer/src/dart/ast/utilities.dart'; |
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 CompilationUnitMember nodeA = newNodes[0]; | 1444 CompilationUnitMember nodeA = newNodes[0]; |
1445 CompilationUnitMember nodeB = newNodes[1]; | 1445 CompilationUnitMember nodeB = newNodes[1]; |
1446 expect(nodeA, same(oldNodes[0])); | 1446 expect(nodeA, same(oldNodes[0])); |
1447 // elements | 1447 // elements |
1448 ClassElement elementA = nodeA.element; | 1448 ClassElement elementA = nodeA.element; |
1449 ClassElement elementB = nodeB.element; | 1449 ClassElement elementB = nodeB.element; |
1450 expect(elementA, isNotNull); | 1450 expect(elementA, isNotNull); |
1451 expect(elementB, isNotNull); | 1451 expect(elementB, isNotNull); |
1452 expect(elementA.name, 'A'); | 1452 expect(elementA.name, 'A'); |
1453 expect(elementB.name, 'B'); | 1453 expect(elementB.name, 'B'); |
| 1454 expect(elementA.fields.map((f) => f.name), |
| 1455 unorderedEquals(['index', 'values', 'A1', 'A2'])); |
| 1456 expect(elementA.accessors.map((a) => a.name), |
| 1457 unorderedEquals(['index', 'values', 'A1', 'A2'])); |
| 1458 expect(elementB.fields.map((f) => f.name), |
| 1459 unorderedEquals(['index', 'values', 'B1', 'B2'])); |
| 1460 expect(elementB.accessors.map((a) => a.name), |
| 1461 unorderedEquals(['index', 'values', 'B1', 'B2'])); |
1454 // unit.types | 1462 // unit.types |
1455 expect(unitElement.enums, unorderedEquals([elementA, elementB])); | 1463 expect(unitElement.enums, unorderedEquals([elementA, elementB])); |
1456 // verify delta | 1464 // verify delta |
1457 expect(unitDelta.addedDeclarations, unorderedEquals([elementB])); | 1465 expect(unitDelta.addedDeclarations, unorderedEquals([elementB])); |
1458 expect(unitDelta.removedDeclarations, unorderedEquals([])); | 1466 expect(unitDelta.removedDeclarations, unorderedEquals([])); |
1459 } | 1467 } |
1460 | 1468 |
1461 test_unitMembers_function_add() { | 1469 test_unitMembers_function_add() { |
1462 _buildOldUnit(r''' | 1470 _buildOldUnit(r''' |
1463 a() {} | 1471 a() {} |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2056 unitMember is ClassDeclaration && unitMember.name.name == name); | 2064 unitMember is ClassDeclaration && unitMember.name.name == name); |
2057 } | 2065 } |
2058 | 2066 |
2059 class _MaterializeLazyElementsVisitor extends GeneralizingElementVisitor { | 2067 class _MaterializeLazyElementsVisitor extends GeneralizingElementVisitor { |
2060 @override | 2068 @override |
2061 visitExecutableElement(ExecutableElement element) { | 2069 visitExecutableElement(ExecutableElement element) { |
2062 element.parameters; | 2070 element.parameters; |
2063 super.visitExecutableElement(element); | 2071 super.visitExecutableElement(element); |
2064 } | 2072 } |
2065 } | 2073 } |
OLD | NEW |