| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.constant_test; | 5 library analyzer.test.constant_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/type.dart'; | 9 import 'package:analyzer/dart/element/type.dart'; |
| 10 import 'package:analyzer/src/dart/element/element.dart'; | 10 import 'package:analyzer/src/dart/element/element.dart'; |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 for (ConstantEvaluationTarget target in _findConstants()) { | 615 for (ConstantEvaluationTarget target in _findConstants()) { |
| 616 if (target is ElementAnnotationImpl) { | 616 if (target is ElementAnnotationImpl) { |
| 617 expect(target.context, same(_context)); | 617 expect(target.context, same(_context)); |
| 618 expect(target.source, same(_source)); | 618 expect(target.source, same(_source)); |
| 619 annotations.add(target.annotationAst); | 619 annotations.add(target.annotationAst); |
| 620 } | 620 } |
| 621 } | 621 } |
| 622 return new List<Annotation>.from(annotations); | 622 return new List<Annotation>.from(annotations); |
| 623 } | 623 } |
| 624 | 624 |
| 625 Set<ConstantEvaluationTarget> _findConstants() { | 625 List<ConstantEvaluationTarget> _findConstants() { |
| 626 ConstantFinder finder = new ConstantFinder(_context, _source, _source); | 626 ConstantFinder finder = new ConstantFinder(_context, _source, _source); |
| 627 _node.accept(finder); | 627 _node.accept(finder); |
| 628 Set<ConstantEvaluationTarget> constants = finder.constantsToCompute; | 628 List<ConstantEvaluationTarget> constants = finder.constantsToCompute; |
| 629 expect(constants, isNotNull); | 629 expect(constants, isNotNull); |
| 630 return constants; | 630 return constants; |
| 631 } | 631 } |
| 632 | 632 |
| 633 ConstructorElement _setupConstructorDeclaration(String name, bool isConst) { | 633 ConstructorElement _setupConstructorDeclaration(String name, bool isConst) { |
| 634 Keyword constKeyword = isConst ? Keyword.CONST : null; | 634 Keyword constKeyword = isConst ? Keyword.CONST : null; |
| 635 ConstructorDeclaration constructorDeclaration = | 635 ConstructorDeclaration constructorDeclaration = |
| 636 AstFactory.constructorDeclaration2( | 636 AstFactory.constructorDeclaration2( |
| 637 constKeyword, | 637 constKeyword, |
| 638 null, | 638 null, |
| (...skipping 3891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4530 | 4530 |
| 4531 void _visitNode(AstNode node) { | 4531 void _visitNode(AstNode node) { |
| 4532 node.accept(_createReferenceFinder(_head)); | 4532 node.accept(_createReferenceFinder(_head)); |
| 4533 } | 4533 } |
| 4534 } | 4534 } |
| 4535 | 4535 |
| 4536 class _TestAnalysisContext extends TestAnalysisContext { | 4536 class _TestAnalysisContext extends TestAnalysisContext { |
| 4537 @override | 4537 @override |
| 4538 InternalAnalysisContext getContextFor(Source source) => this; | 4538 InternalAnalysisContext getContextFor(Source source) => this; |
| 4539 } | 4539 } |
| OLD | NEW |