| 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 | 9 import '../common/names.dart' show |
| 10 Identifiers, | 10 Identifiers, |
| (...skipping 3419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3430 callStructure = translateStaticArguments(argumentList, element, | 3430 callStructure = translateStaticArguments(argumentList, element, |
| 3431 callStructure, arguments); | 3431 callStructure, arguments); |
| 3432 Selector selector = new Selector.call(element.memberName, callStructure); | 3432 Selector selector = new Selector.call(element.memberName, callStructure); |
| 3433 return irBuilder.buildInvokeStatic(element, selector, arguments, | 3433 return irBuilder.buildInvokeStatic(element, selector, arguments, |
| 3434 sourceInformationBuilder.buildCall(node, node.selector)); | 3434 sourceInformationBuilder.buildCall(node, node.selector)); |
| 3435 } | 3435 } |
| 3436 | 3436 |
| 3437 /// Lookup the value of the enum described by [node]. | 3437 /// Lookup the value of the enum described by [node]. |
| 3438 getEnumValue(ast.Node node, EnumClassElement enumClass, List values) { | 3438 getEnumValue(ast.Node node, EnumClassElement enumClass, List values) { |
| 3439 Element element = elements[node]; | 3439 Element element = elements[node]; |
| 3440 if (element is! FieldElement || element.enclosingClass != enumClass) { | 3440 if (element is! EnumConstantElement || |
| 3441 element.enclosingClass != enumClass) { |
| 3441 internalError(node, 'expected a JsBuiltin enum value'); | 3442 internalError(node, 'expected a JsBuiltin enum value'); |
| 3442 } | 3443 } |
| 3443 | 3444 EnumConstantElement enumConstant = element; |
| 3444 int index = enumClass.enumValues.indexOf(element); | 3445 int index = enumConstant.index; |
| 3445 return values[index]; | 3446 return values[index]; |
| 3446 } | 3447 } |
| 3447 | 3448 |
| 3448 /// Returns the String the node evaluates to, or throws an error if the | 3449 /// Returns the String the node evaluates to, or throws an error if the |
| 3449 /// result is not a string constant. | 3450 /// result is not a string constant. |
| 3450 String expectStringConstant(ast.Node node) { | 3451 String expectStringConstant(ast.Node node) { |
| 3451 ir.Primitive nameValue = visit(node); | 3452 ir.Primitive nameValue = visit(node); |
| 3452 if (nameValue is ir.Constant && nameValue.value.isString) { | 3453 if (nameValue is ir.Constant && nameValue.value.isString) { |
| 3453 StringConstantValue constantValue = nameValue.value; | 3454 StringConstantValue constantValue = nameValue.value; |
| 3454 return constantValue.primitiveValue.slowToString(); | 3455 return constantValue.primitiveValue.slowToString(); |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4327 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass); | 4328 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass); |
| 4328 | 4329 |
| 4329 String getJsInteropTargetPath(FunctionElement element) { | 4330 String getJsInteropTargetPath(FunctionElement element) { |
| 4330 return '${_backend.namer.fixedBackendPath(element)}.' | 4331 return '${_backend.namer.fixedBackendPath(element)}.' |
| 4331 '${_backend.nativeData.getFixedBackendName(element)}'; | 4332 '${_backend.nativeData.getFixedBackendName(element)}'; |
| 4332 } | 4333 } |
| 4333 | 4334 |
| 4334 DartType get jsJavascriptObjectType => | 4335 DartType get jsJavascriptObjectType => |
| 4335 _backend.helpers.jsJavaScriptObjectClass.thisType; | 4336 _backend.helpers.jsJavaScriptObjectClass.thisType; |
| 4336 } | 4337 } |
| OLD | NEW |