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); |
33 } | 34 } |
34 | 35 |
35 /** | 36 /** |
36 * Implementation of [ConstantEvaluationValidator] used during unit tests; | 37 * Implementation of [ConstantEvaluationValidator] used during unit tests; |
37 * verifies that any nodes referenced during constant evaluation are present in | 38 * verifies that any nodes referenced during constant evaluation are present in |
38 * the dependency graph. | 39 * the dependency graph. |
39 */ | 40 */ |
40 class ConstantEvaluationValidator_ForTest | 41 class ConstantEvaluationValidator_ForTest |
41 implements ConstantEvaluationValidator { | 42 implements ConstantEvaluationValidator { |
42 final InternalAnalysisContext context; | 43 final InternalAnalysisContext context; |
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); | 1594 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); |
1594 DartObjectImpl result = expression.accept(new ConstantVisitor( | 1595 DartObjectImpl result = expression.accept(new ConstantVisitor( |
1595 new ConstantEvaluationEngine(typeProvider, new DeclaredVariables(), | 1596 new ConstantEvaluationEngine(typeProvider, new DeclaredVariables(), |
1596 typeSystem: typeSystem), | 1597 typeSystem: typeSystem), |
1597 errorReporter, | 1598 errorReporter, |
1598 lexicalEnvironment: lexicalEnvironment)); | 1599 lexicalEnvironment: lexicalEnvironment)); |
1599 errorListener.assertNoErrors(); | 1600 errorListener.assertNoErrors(); |
1600 return result; | 1601 return result; |
1601 } | 1602 } |
1602 } | 1603 } |
| 1604 |
| 1605 @reflectiveTest |
| 1606 class StrongConstantValueComputerTest extends ConstantValueComputerTest { |
| 1607 void setUp() { |
| 1608 super.setUp(); |
| 1609 resetWithOptions(new AnalysisOptionsImpl()..strongMode = true); |
| 1610 } |
| 1611 } |
OLD | NEW |