OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.ir_builder_task; | 5 library dart2js.ir_builder_task; |
6 | 6 |
7 import 'package:js_runtime/shared/embedded_names.dart' | 7 import 'package:js_runtime/shared/embedded_names.dart' |
8 show JsBuiltin, JsGetName; | 8 show JsBuiltin, JsGetName; |
9 | 9 |
10 import '../closure.dart' as closure; | 10 import '../closure.dart' as closure; |
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1674 ir.Primitive visitLiteralString(ast.LiteralString node) { | 1674 ir.Primitive visitLiteralString(ast.LiteralString node) { |
1675 assert(irBuilder.isOpen); | 1675 assert(irBuilder.isOpen); |
1676 return irBuilder.buildDartStringConstant(node.dartString); | 1676 return irBuilder.buildDartStringConstant(node.dartString); |
1677 } | 1677 } |
1678 | 1678 |
1679 ConstantValue getConstantForNode(ast.Node node) { | 1679 ConstantValue getConstantForNode(ast.Node node) { |
1680 return irBuilder.state.constants.getConstantValueForNode(node, elements); | 1680 return irBuilder.state.constants.getConstantValueForNode(node, elements); |
1681 } | 1681 } |
1682 | 1682 |
1683 ConstantValue getConstantForVariable(VariableElement element) { | 1683 ConstantValue getConstantForVariable(VariableElement element) { |
1684 return irBuilder.state.constants.getConstantValue(element.constant); | 1684 ConstantExpression constant = element.constant; |
| 1685 if (constant != null) { |
| 1686 return irBuilder.state.constants.getConstantValue(constant); |
| 1687 } |
| 1688 return null; |
1685 } | 1689 } |
1686 | 1690 |
1687 ir.Primitive buildConstantExpression( | 1691 ir.Primitive buildConstantExpression( |
1688 ConstantExpression expression, SourceInformation sourceInformation) { | 1692 ConstantExpression expression, SourceInformation sourceInformation) { |
1689 return irBuilder.buildConstant( | 1693 return irBuilder.buildConstant( |
1690 irBuilder.state.constants.getConstantValue(expression), | 1694 irBuilder.state.constants.getConstantValue(expression), |
1691 sourceInformation: sourceInformation); | 1695 sourceInformation: sourceInformation); |
1692 } | 1696 } |
1693 | 1697 |
1694 /// Returns the allocation site-specific type for a given allocation. | 1698 /// Returns the allocation site-specific type for a given allocation. |
(...skipping 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4014 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass); | 4018 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass); |
4015 | 4019 |
4016 String getJsInteropTargetPath(FunctionElement element) { | 4020 String getJsInteropTargetPath(FunctionElement element) { |
4017 return '${_backend.namer.fixedBackendPath(element)}.' | 4021 return '${_backend.namer.fixedBackendPath(element)}.' |
4018 '${_backend.nativeData.getFixedBackendName(element)}'; | 4022 '${_backend.nativeData.getFixedBackendName(element)}'; |
4019 } | 4023 } |
4020 | 4024 |
4021 DartType get jsJavascriptObjectType => | 4025 DartType get jsJavascriptObjectType => |
4022 _backend.helpers.jsJavaScriptObjectClass.thisType; | 4026 _backend.helpers.jsJavaScriptObjectClass.thisType; |
4023 } | 4027 } |
OLD | NEW |