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 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 expect(field.type.name, "int"); | 1189 expect(field.type.name, "int"); |
1190 expect(field.toIntValue(), expectedValue); | 1190 expect(field.toIntValue(), expectedValue); |
1191 } | 1191 } |
1192 | 1192 |
1193 void _assertNullField(Map<String, DartObjectImpl> fields, String fieldName) { | 1193 void _assertNullField(Map<String, DartObjectImpl> fields, String fieldName) { |
1194 DartObjectImpl field = fields[fieldName]; | 1194 DartObjectImpl field = fields[fieldName]; |
1195 expect(field.isNull, isTrue); | 1195 expect(field.isNull, isTrue); |
1196 } | 1196 } |
1197 | 1197 |
1198 void _assertProperDependencies(String sourceText, | 1198 void _assertProperDependencies(String sourceText, |
1199 [List<ErrorCode> expectedErrorCodes = ErrorCode.EMPTY_LIST]) { | 1199 [List<ErrorCode> expectedErrorCodes = const <ErrorCode>[]]) { |
1200 Source source = addSource(sourceText); | 1200 Source source = addSource(sourceText); |
1201 LibraryElement element = resolve2(source); | 1201 LibraryElement element = resolve2(source); |
1202 CompilationUnit unit = | 1202 CompilationUnit unit = |
1203 analysisContext.resolveCompilationUnit(source, element); | 1203 analysisContext.resolveCompilationUnit(source, element); |
1204 expect(unit, isNotNull); | 1204 expect(unit, isNotNull); |
1205 ConstantValueComputer computer = _makeConstantValueComputer(); | 1205 ConstantValueComputer computer = _makeConstantValueComputer(); |
1206 computer.add(unit); | 1206 computer.add(unit); |
1207 computer.computeValues(); | 1207 computer.computeValues(); |
1208 assertErrors(source, expectedErrorCodes); | 1208 assertErrors(source, expectedErrorCodes); |
1209 } | 1209 } |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1604 } | 1604 } |
1605 } | 1605 } |
1606 | 1606 |
1607 @reflectiveTest | 1607 @reflectiveTest |
1608 class StrongConstantValueComputerTest extends ConstantValueComputerTest { | 1608 class StrongConstantValueComputerTest extends ConstantValueComputerTest { |
1609 void setUp() { | 1609 void setUp() { |
1610 super.setUp(); | 1610 super.setUp(); |
1611 resetWithOptions(new AnalysisOptionsImpl()..strongMode = true); | 1611 resetWithOptions(new AnalysisOptionsImpl()..strongMode = true); |
1612 } | 1612 } |
1613 } | 1613 } |
OLD | NEW |