Chromium Code Reviews| 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/standard_ast_factory.dart'; | 8 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; |
| 9 import 'package:analyzer/dart/ast/token.dart'; | 9 import 'package:analyzer/dart/ast/token.dart'; |
| 10 import 'package:analyzer/src/dart/ast/token.dart'; | 10 import 'package:analyzer/src/dart/ast/token.dart'; |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 624 } | 624 } |
| 625 } | 625 } |
| 626 | 626 |
| 627 void test_inGetterContext_constructorFieldInitializer() { | 627 void test_inGetterContext_constructorFieldInitializer() { |
| 628 ConstructorFieldInitializer initializer = AstTestFactory | 628 ConstructorFieldInitializer initializer = AstTestFactory |
| 629 .constructorFieldInitializer(false, 'f', AstTestFactory.integer(0)); | 629 .constructorFieldInitializer(false, 'f', AstTestFactory.integer(0)); |
| 630 SimpleIdentifier identifier = initializer.fieldName; | 630 SimpleIdentifier identifier = initializer.fieldName; |
| 631 expect(identifier.inGetterContext(), isFalse); | 631 expect(identifier.inGetterContext(), isFalse); |
| 632 } | 632 } |
| 633 | 633 |
| 634 void test_inGetterContext_fieldFormalParameter() { | |
| 635 FieldFormalParameter parameter = | |
| 636 AstTestFactory.fieldFormalParameter2('test'); | |
| 637 SimpleIdentifier identifier = parameter.identifier; | |
| 638 expect(identifier.inGetterContext(), isFalse); | |
| 639 } | |
| 640 | |
| 634 void test_inGetterContext_forEachLoop() { | 641 void test_inGetterContext_forEachLoop() { |
| 635 SimpleIdentifier identifier = AstTestFactory.identifier3("a"); | 642 SimpleIdentifier identifier = AstTestFactory.identifier3("a"); |
| 636 Expression iterator = AstTestFactory.listLiteral(); | 643 Expression iterator = AstTestFactory.listLiteral(); |
| 637 Statement body = AstTestFactory.block(); | 644 Statement body = AstTestFactory.block(); |
| 638 AstTestFactory.forEachStatement2(identifier, iterator, body); | 645 AstTestFactory.forEachStatement2(identifier, iterator, body); |
| 639 expect(identifier.inGetterContext(), isFalse); | 646 expect(identifier.inGetterContext(), isFalse); |
| 640 } | 647 } |
| 641 | 648 |
| 649 void test_inGetterContext_variableDeclaration() { | |
| 650 VariableDeclaration variable = AstTestFactory.variableDeclaration('testt'); | |
|
Brian Wilkerson
2017/04/27 17:34:16
nit: doubled 't'
| |
| 651 SimpleIdentifier identifier = variable.name; | |
| 652 expect(identifier.inGetterContext(), isFalse); | |
| 653 } | |
| 654 | |
| 642 void test_inReferenceContext() { | 655 void test_inReferenceContext() { |
| 643 SimpleIdentifier identifier = AstTestFactory.identifier3("id"); | 656 SimpleIdentifier identifier = AstTestFactory.identifier3("id"); |
| 644 AstTestFactory.namedExpression( | 657 AstTestFactory.namedExpression( |
| 645 AstTestFactory.label(identifier), AstTestFactory.identifier3("_")); | 658 AstTestFactory.label(identifier), AstTestFactory.identifier3("_")); |
| 646 expect(identifier.inGetterContext(), isFalse); | 659 expect(identifier.inGetterContext(), isFalse); |
| 647 expect(identifier.inSetterContext(), isFalse); | 660 expect(identifier.inSetterContext(), isFalse); |
| 648 } | 661 } |
| 649 | 662 |
| 650 void test_inSetterContext() { | 663 void test_inSetterContext() { |
| 651 for (_WrapperKind wrapper in _WrapperKind.values) { | 664 for (_WrapperKind wrapper in _WrapperKind.values) { |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1301 final int ordinal; | 1314 final int ordinal; |
| 1302 | 1315 |
| 1303 const _WrapperKind(this.name, this.ordinal); | 1316 const _WrapperKind(this.name, this.ordinal); |
| 1304 | 1317 |
| 1305 int get hashCode => ordinal; | 1318 int get hashCode => ordinal; |
| 1306 | 1319 |
| 1307 int compareTo(_WrapperKind other) => ordinal - other.ordinal; | 1320 int compareTo(_WrapperKind other) => ordinal - other.ordinal; |
| 1308 | 1321 |
| 1309 String toString() => name; | 1322 String toString() => name; |
| 1310 } | 1323 } |
| OLD | NEW |