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/context/declared_variables.dart'; | 7 import 'package:analyzer/context/declared_variables.dart'; |
8 import 'package:analyzer/dart/ast/ast.dart'; | 8 import 'package:analyzer/dart/ast/ast.dart'; |
9 import 'package:analyzer/dart/ast/token.dart'; | 9 import 'package:analyzer/dart/ast/token.dart'; |
10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 import '../../../generated/resolver_test_case.dart'; | 24 import '../../../generated/resolver_test_case.dart'; |
25 import '../../../generated/test_support.dart'; | 25 import '../../../generated/test_support.dart'; |
26 import '../../../reflective_tests.dart'; | 26 import '../../../reflective_tests.dart'; |
27 import '../../../utils.dart'; | 27 import '../../../utils.dart'; |
28 | 28 |
29 main() { | 29 main() { |
30 initializeTestEnvironment(); | 30 initializeTestEnvironment(); |
31 runReflectiveTests(ConstantValueComputerTest); | 31 runReflectiveTests(ConstantValueComputerTest); |
32 runReflectiveTests(ConstantVisitorTest); | 32 runReflectiveTests(ConstantVisitorTest); |
33 runReflectiveTests(StrongConstantValueComputerTest); | |
34 } | 33 } |
35 | 34 |
36 /** | 35 /** |
37 * Implementation of [ConstantEvaluationValidator] used during unit tests; | 36 * Implementation of [ConstantEvaluationValidator] used during unit tests; |
38 * verifies that any nodes referenced during constant evaluation are present in | 37 * verifies that any nodes referenced during constant evaluation are present in |
39 * the dependency graph. | 38 * the dependency graph. |
40 */ | 39 */ |
41 class ConstantEvaluationValidator_ForTest | 40 class ConstantEvaluationValidator_ForTest |
42 implements ConstantEvaluationValidator { | 41 implements ConstantEvaluationValidator { |
43 final InternalAnalysisContext context; | 42 final InternalAnalysisContext context; |
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); | 1593 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); |
1595 DartObjectImpl result = expression.accept(new ConstantVisitor( | 1594 DartObjectImpl result = expression.accept(new ConstantVisitor( |
1596 new ConstantEvaluationEngine(typeProvider, new DeclaredVariables(), | 1595 new ConstantEvaluationEngine(typeProvider, new DeclaredVariables(), |
1597 typeSystem: typeSystem), | 1596 typeSystem: typeSystem), |
1598 errorReporter, | 1597 errorReporter, |
1599 lexicalEnvironment: lexicalEnvironment)); | 1598 lexicalEnvironment: lexicalEnvironment)); |
1600 errorListener.assertNoErrors(); | 1599 errorListener.assertNoErrors(); |
1601 return result; | 1600 return result; |
1602 } | 1601 } |
1603 } | 1602 } |
1604 | |
1605 @reflectiveTest | |
1606 class StrongConstantValueComputerTest extends ConstantValueComputerTest { | |
1607 void setUp() { | |
1608 super.setUp(); | |
1609 resetWithOptions(new AnalysisOptionsImpl()..strongMode = true); | |
1610 } | |
1611 } | |
OLD | NEW |