| 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/ast/token.dart'; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
| 11 import 'package:analyzer/src/dart/ast/token.dart'; |
| 10 import 'package:analyzer/src/dart/element/element.dart'; | 12 import 'package:analyzer/src/dart/element/element.dart'; |
| 11 import 'package:analyzer/src/generated/constant.dart'; | 13 import 'package:analyzer/src/generated/constant.dart'; |
| 12 import 'package:analyzer/src/generated/engine.dart'; | 14 import 'package:analyzer/src/generated/engine.dart'; |
| 13 import 'package:analyzer/src/generated/error.dart'; | 15 import 'package:analyzer/src/generated/error.dart'; |
| 14 import 'package:analyzer/src/generated/resolver.dart'; | 16 import 'package:analyzer/src/generated/resolver.dart'; |
| 15 import 'package:analyzer/src/generated/scanner.dart'; | |
| 16 import 'package:analyzer/src/generated/source.dart'; | 17 import 'package:analyzer/src/generated/source.dart'; |
| 17 import 'package:analyzer/src/generated/source_io.dart'; | 18 import 'package:analyzer/src/generated/source_io.dart'; |
| 18 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 19 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
| 19 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 20 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
| 20 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; | 21 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; |
| 21 import 'package:analyzer/src/generated/utilities_collection.dart'; | 22 import 'package:analyzer/src/generated/utilities_collection.dart'; |
| 22 import 'package:analyzer/src/task/dart.dart'; | 23 import 'package:analyzer/src/task/dart.dart'; |
| 23 import 'package:path/path.dart'; | 24 import 'package:path/path.dart'; |
| 24 import 'package:unittest/unittest.dart'; | 25 import 'package:unittest/unittest.dart'; |
| 25 | 26 |
| 26 import '../reflective_tests.dart'; | 27 import '../reflective_tests.dart'; |
| 27 import '../utils.dart'; | 28 import '../utils.dart'; |
| 28 import 'engine_test.dart'; | 29 import 'engine_test.dart'; |
| 29 import 'resolver_test.dart'; | 30 import 'resolver_test.dart'; |
| 30 import 'test_support.dart'; | 31 import 'test_support.dart'; |
| 31 | 32 |
| 32 const int LONG_MAX_VALUE = 0x7fffffffffffffff; | |
| 33 | |
| 34 main() { | 33 main() { |
| 35 initializeTestEnvironment(); | 34 initializeTestEnvironment(); |
| 36 runReflectiveTests(ConstantEvaluatorTest); | 35 runReflectiveTests(ConstantEvaluatorTest); |
| 37 runReflectiveTests(ConstantFinderTest); | 36 runReflectiveTests(ConstantFinderTest); |
| 38 runReflectiveTests(ConstantValueComputerTest); | 37 runReflectiveTests(ConstantValueComputerTest); |
| 39 runReflectiveTests(ConstantVisitorTest); | 38 runReflectiveTests(ConstantVisitorTest); |
| 40 runReflectiveTests(DartObjectImplTest); | 39 runReflectiveTests(DartObjectImplTest); |
| 41 runReflectiveTests(DeclaredVariablesTest); | 40 runReflectiveTests(DeclaredVariablesTest); |
| 42 runReflectiveTests(ReferenceFinderTest); | 41 runReflectiveTests(ReferenceFinderTest); |
| 43 } | 42 } |
| 44 | 43 |
| 44 const int LONG_MAX_VALUE = 0x7fffffffffffffff; |
| 45 |
| 45 /** | 46 /** |
| 46 * Implementation of [ConstantEvaluationValidator] used during unit tests; | 47 * Implementation of [ConstantEvaluationValidator] used during unit tests; |
| 47 * verifies that any nodes referenced during constant evaluation are present in | 48 * verifies that any nodes referenced during constant evaluation are present in |
| 48 * the dependency graph. | 49 * the dependency graph. |
| 49 */ | 50 */ |
| 50 class ConstantEvaluationValidator_ForTest | 51 class ConstantEvaluationValidator_ForTest |
| 51 implements ConstantEvaluationValidator { | 52 implements ConstantEvaluationValidator { |
| 52 final InternalAnalysisContext context; | 53 final InternalAnalysisContext context; |
| 53 ConstantValueComputer computer; | 54 ConstantValueComputer computer; |
| 54 ConstantEvaluationTarget _nodeBeingEvaluated; | 55 ConstantEvaluationTarget _nodeBeingEvaluated; |
| (...skipping 4476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4531 | 4532 |
| 4532 void _visitNode(AstNode node) { | 4533 void _visitNode(AstNode node) { |
| 4533 node.accept(_createReferenceFinder(_head)); | 4534 node.accept(_createReferenceFinder(_head)); |
| 4534 } | 4535 } |
| 4535 } | 4536 } |
| 4536 | 4537 |
| 4537 class _TestAnalysisContext extends TestAnalysisContext { | 4538 class _TestAnalysisContext extends TestAnalysisContext { |
| 4538 @override | 4539 @override |
| 4539 InternalAnalysisContext getContextFor(Source source) => this; | 4540 InternalAnalysisContext getContextFor(Source source) => this; |
| 4540 } | 4541 } |
| OLD | NEW |