| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.dart.ast.ast_test; | 5 library analyzer.test.dart.ast.ast_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
| 9 import 'package:analyzer/src/dart/ast/token.dart'; | 9 import 'package:analyzer/src/dart/ast/token.dart'; |
| 10 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 10 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 } | 585 } |
| 586 } else { | 586 } else { |
| 587 if (!identifier.inGetterContext()) { | 587 if (!identifier.inGetterContext()) { |
| 588 fail("Expected ${_topMostNode(identifier).toSource()} to be true"); | 588 fail("Expected ${_topMostNode(identifier).toSource()} to be true"); |
| 589 } | 589 } |
| 590 } | 590 } |
| 591 } | 591 } |
| 592 } | 592 } |
| 593 } | 593 } |
| 594 | 594 |
| 595 void test_inGetterContext_constructorFieldInitializer() { |
| 596 ConstructorFieldInitializer initializer = AstFactory |
| 597 .constructorFieldInitializer(false, 'f', AstFactory.integer(0)); |
| 598 SimpleIdentifier identifier = initializer.fieldName; |
| 599 expect(identifier.inGetterContext(), isFalse); |
| 600 } |
| 601 |
| 595 void test_inGetterContext_forEachLoop() { | 602 void test_inGetterContext_forEachLoop() { |
| 596 SimpleIdentifier identifier = AstFactory.identifier3("a"); | 603 SimpleIdentifier identifier = AstFactory.identifier3("a"); |
| 597 Expression iterator = AstFactory.listLiteral(); | 604 Expression iterator = AstFactory.listLiteral(); |
| 598 Statement body = AstFactory.block(); | 605 Statement body = AstFactory.block(); |
| 599 AstFactory.forEachStatement2(identifier, iterator, body); | 606 AstFactory.forEachStatement2(identifier, iterator, body); |
| 600 expect(identifier.inGetterContext(), isFalse); | 607 expect(identifier.inGetterContext(), isFalse); |
| 601 } | 608 } |
| 602 | 609 |
| 603 void test_inReferenceContext() { | 610 void test_inReferenceContext() { |
| 604 SimpleIdentifier identifier = AstFactory.identifier3("id"); | 611 SimpleIdentifier identifier = AstFactory.identifier3("id"); |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 final int ordinal; | 1227 final int ordinal; |
| 1221 | 1228 |
| 1222 const _WrapperKind(this.name, this.ordinal); | 1229 const _WrapperKind(this.name, this.ordinal); |
| 1223 | 1230 |
| 1224 int get hashCode => ordinal; | 1231 int get hashCode => ordinal; |
| 1225 | 1232 |
| 1226 int compareTo(_WrapperKind other) => ordinal - other.ordinal; | 1233 int compareTo(_WrapperKind other) => ordinal - other.ordinal; |
| 1227 | 1234 |
| 1228 String toString() => name; | 1235 String toString() => name; |
| 1229 } | 1236 } |
| OLD | NEW |