OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 dart2js.constants.expressions.evaluate_test; | 5 library dart2js.constants.expressions.evaluate_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
10 import 'package:compiler/src/common/backend_api.dart'; | 10 import 'package:compiler/src/common/backend_api.dart'; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 return field.constant; | 64 return field.constant; |
65 } | 65 } |
66 | 66 |
67 @override | 67 @override |
68 ConstantExpression getLocalConstant(LocalVariableElement local) { | 68 ConstantExpression getLocalConstant(LocalVariableElement local) { |
69 return local.constant; | 69 return local.constant; |
70 } | 70 } |
71 | 71 |
72 @override | 72 @override |
73 CommonElements get commonElements => _compiler.commonElements; | 73 CommonElements get commonElements => _compiler.commonElements; |
74 | |
75 @override | |
76 BackendClasses get backendClasses => _compiler.backend.backendClasses; | |
77 } | 74 } |
78 | 75 |
79 const List<TestData> DATA = const [ | 76 const List<TestData> DATA = const [ |
80 const TestData('', const [ | 77 const TestData('', const [ |
81 const ConstantData('null', const {const {}: 'NullConstant'}), | 78 const ConstantData('null', const {const {}: 'NullConstant'}), |
82 const ConstantData('false', const {const {}: 'BoolConstant(false)'}), | 79 const ConstantData('false', const {const {}: 'BoolConstant(false)'}), |
83 const ConstantData('true', const {const {}: 'BoolConstant(true)'}), | 80 const ConstantData('true', const {const {}: 'BoolConstant(true)'}), |
84 const ConstantData('0', const {const {}: 'IntConstant(0)'}), | 81 const ConstantData('0', const {const {}: 'IntConstant(0)'}), |
85 const ConstantData('0.0', const {const {}: 'DoubleConstant(0.0)'}), | 82 const ConstantData('0.0', const {const {}: 'DoubleConstant(0.0)'}), |
86 const ConstantData('"foo"', const {const {}: 'StringConstant("foo")'}), | 83 const ConstantData('"foo"', const {const {}: 'StringConstant("foo")'}), |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 constant.evaluate(environment, DART_CONSTANT_SYSTEM); | 286 constant.evaluate(environment, DART_CONSTANT_SYSTEM); |
290 String valueText = value.toStructuredText(); | 287 String valueText = value.toStructuredText(); |
291 Expect.equals( | 288 Expect.equals( |
292 expectedText, | 289 expectedText, |
293 valueText, | 290 valueText, |
294 "Unexpected value '${valueText}' for contant " | 291 "Unexpected value '${valueText}' for contant " |
295 "`${constant.toDartText()}`, expected '${expectedText}'."); | 292 "`${constant.toDartText()}`, expected '${expectedText}'."); |
296 }); | 293 }); |
297 }); | 294 }); |
298 } | 295 } |
OLD | NEW |