| 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 '../closure.dart' as closure; | 7 import '../closure.dart' as closure; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common/names.dart' show Identifiers, Names, Selectors; | 9 import '../common/names.dart' show Identifiers, Names, Selectors; |
| 10 import '../common/tasks.dart' show CompilerTask; | 10 import '../common/tasks.dart' show CompilerTask; |
| (...skipping 3161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3172 callStructure = translateStaticArguments( | 3172 callStructure = translateStaticArguments( |
| 3173 argumentList, element, callStructure, arguments); | 3173 argumentList, element, callStructure, arguments); |
| 3174 Selector selector = new Selector.call(element.memberName, callStructure); | 3174 Selector selector = new Selector.call(element.memberName, callStructure); |
| 3175 return irBuilder.buildInvokeStatic(element, selector, arguments, | 3175 return irBuilder.buildInvokeStatic(element, selector, arguments, |
| 3176 sourceInformationBuilder.buildCall(node, node.selector)); | 3176 sourceInformationBuilder.buildCall(node, node.selector)); |
| 3177 } | 3177 } |
| 3178 | 3178 |
| 3179 /// Lookup the value of the enum described by [node]. | 3179 /// Lookup the value of the enum described by [node]. |
| 3180 getEnumValue(ast.Node node, EnumClassElement enumClass, List values) { | 3180 getEnumValue(ast.Node node, EnumClassElement enumClass, List values) { |
| 3181 Element element = elements[node]; | 3181 Element element = elements[node]; |
| 3182 if (element is! FieldElement || element.enclosingClass != enumClass) { | 3182 if (element is! EnumConstantElement || |
| 3183 element.enclosingClass != enumClass) { |
| 3183 internalError(node, 'expected a JsBuiltin enum value'); | 3184 internalError(node, 'expected a JsBuiltin enum value'); |
| 3184 } | 3185 } |
| 3185 | 3186 EnumConstantElement enumConstant = element; |
| 3186 int index = enumClass.enumValues.indexOf(element); | 3187 int index = enumConstant.index; |
| 3187 return values[index]; | 3188 return values[index]; |
| 3188 } | 3189 } |
| 3189 | 3190 |
| 3190 /// Returns the String the node evaluates to, or throws an error if the | 3191 /// Returns the String the node evaluates to, or throws an error if the |
| 3191 /// result is not a string constant. | 3192 /// result is not a string constant. |
| 3192 String expectStringConstant(ast.Node node) { | 3193 String expectStringConstant(ast.Node node) { |
| 3193 ir.Primitive nameValue = visit(node); | 3194 ir.Primitive nameValue = visit(node); |
| 3194 if (nameValue is ir.Constant && nameValue.value.isString) { | 3195 if (nameValue is ir.Constant && nameValue.value.isString) { |
| 3195 StringConstantValue constantValue = nameValue.value; | 3196 StringConstantValue constantValue = nameValue.value; |
| 3196 return constantValue.primitiveValue.slowToString(); | 3197 return constantValue.primitiveValue.slowToString(); |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4018 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass); | 4019 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass); |
| 4019 | 4020 |
| 4020 String getJsInteropTargetPath(FunctionElement element) { | 4021 String getJsInteropTargetPath(FunctionElement element) { |
| 4021 return '${_backend.namer.fixedBackendPath(element)}.' | 4022 return '${_backend.namer.fixedBackendPath(element)}.' |
| 4022 '${_backend.nativeData.getFixedBackendName(element)}'; | 4023 '${_backend.nativeData.getFixedBackendName(element)}'; |
| 4023 } | 4024 } |
| 4024 | 4025 |
| 4025 DartType get jsJavascriptObjectType => | 4026 DartType get jsJavascriptObjectType => |
| 4026 _backend.helpers.jsJavaScriptObjectClass.thisType; | 4027 _backend.helpers.jsJavaScriptObjectClass.thisType; |
| 4027 } | 4028 } |
| OLD | NEW |