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 import 'package:js_runtime/shared/embedded_names.dart'; | 5 import 'package:js_runtime/shared/embedded_names.dart'; |
6 import 'package:kernel/ast.dart' as ir; | 6 import 'package:kernel/ast.dart' as ir; |
7 | 7 |
8 import '../constants/expressions.dart'; | 8 import '../constants/expressions.dart'; |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../common/names.dart'; | 10 import '../common/names.dart'; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 248 } |
249 | 249 |
250 ConstantValue getConstantFor(ir.Node node) { | 250 ConstantValue getConstantFor(ir.Node node) { |
251 ConstantValue constantValue = | 251 ConstantValue constantValue = |
252 _backend.constants.getConstantValueForNode(getNode(node), elements); | 252 _backend.constants.getConstantValueForNode(getNode(node), elements); |
253 assert(invariant(getNode(node), constantValue != null, | 253 assert(invariant(getNode(node), constantValue != null, |
254 message: 'No constant computed for $node')); | 254 message: 'No constant computed for $node')); |
255 return constantValue; | 255 return constantValue; |
256 } | 256 } |
257 | 257 |
| 258 ConstantValue getConstantForType(ir.DartType irType) { |
| 259 DartType type = getDartType(irType); |
| 260 return _backend.constantSystem.createType(_compiler, type.asRaw()); |
| 261 } |
| 262 |
258 bool isIntercepted(ir.Node node) { | 263 bool isIntercepted(ir.Node node) { |
259 Selector selector = getSelector(node); | 264 Selector selector = getSelector(node); |
260 return _backend.isInterceptedSelector(selector); | 265 return _backend.isInterceptedSelector(selector); |
261 } | 266 } |
262 | 267 |
263 bool isInterceptedSelector(Selector selector) { | 268 bool isInterceptedSelector(Selector selector) { |
264 return _backend.isInterceptedSelector(selector); | 269 return _backend.isInterceptedSelector(selector); |
265 } | 270 } |
266 | 271 |
267 LibraryElement get jsHelperLibrary => _backend.helpers.jsHelperLibrary; | 272 LibraryElement get jsHelperLibrary => _backend.helpers.jsHelperLibrary; |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 astAdapter.reporter.internalError( | 744 astAdapter.reporter.internalError( |
740 CURRENT_ELEMENT_SPANNABLE, "Unexpected constant target: $element."); | 745 CURRENT_ELEMENT_SPANNABLE, "Unexpected constant target: $element."); |
741 return null; | 746 return null; |
742 } | 747 } |
743 | 748 |
744 @override | 749 @override |
745 ConstantExpression visitStringLiteral(ir.StringLiteral node) { | 750 ConstantExpression visitStringLiteral(ir.StringLiteral node) { |
746 return new StringConstantExpression(node.value); | 751 return new StringConstantExpression(node.value); |
747 } | 752 } |
748 } | 753 } |
OLD | NEW |