| 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 import '../compiler.dart' show Compiler; | 5 import '../compiler.dart' show Compiler; |
| 6 import '../elements/resolution_types.dart'; | 6 import '../elements/resolution_types.dart'; |
| 7 import '../elements/elements.dart'; | 7 import '../elements/elements.dart'; |
| 8 import '../js/js.dart' as jsAst; | 8 import '../js/js.dart' as jsAst; |
| 9 import '../js/js.dart' show js; | 9 import '../js/js.dart' show js; |
| 10 import '../ssa/codegen.dart' show SsaCodeGenerator; | 10 import '../ssa/codegen.dart' show SsaCodeGenerator; |
| 11 import '../ssa/nodes.dart' show HTypeConversion; | 11 import '../ssa/nodes.dart' show HTypeConversion; |
| 12 import '../universe/call_structure.dart' show CallStructure; | 12 import '../universe/call_structure.dart' show CallStructure; |
| 13 import '../universe/use.dart' show StaticUse; | 13 import '../universe/use.dart' show StaticUse; |
| 14 import 'backend.dart'; | 14 import 'backend.dart'; |
| 15 | 15 |
| 16 class CheckedModeHelper { | 16 class CheckedModeHelper { |
| 17 final String name; | 17 final String name; |
| 18 | 18 |
| 19 const CheckedModeHelper(String this.name); | 19 const CheckedModeHelper(String this.name); |
| 20 | 20 |
| 21 StaticUse getStaticUse(Compiler compiler) { | 21 StaticUse getStaticUse(Compiler compiler) { |
| 22 JavaScriptBackend backend = compiler.backend; | 22 JavaScriptBackend backend = compiler.backend; |
| 23 // TODO(johnniwinther): Refactor this to avoid looking up directly in the | 23 // TODO(johnniwinther): Refactor this to avoid looking up directly in the |
| 24 // js helper library but instead access helpers directly on backend helpers. | 24 // js helper library but instead access helpers directly on backend helpers. |
| 25 MethodElement method = backend.helpers.jsHelperLibrary.find(name); | 25 LibraryElement jsHelperLibrary = backend.helpers.jsHelperLibrary; |
| 26 MethodElement method = jsHelperLibrary.find(name); |
| 26 return new StaticUse.staticInvoke(method, callStructure); | 27 return new StaticUse.staticInvoke(method, callStructure); |
| 27 } | 28 } |
| 28 | 29 |
| 29 CallStructure get callStructure => CallStructure.ONE_ARG; | 30 CallStructure get callStructure => CallStructure.ONE_ARG; |
| 30 | 31 |
| 31 jsAst.Expression generateCall( | 32 jsAst.Expression generateCall( |
| 32 SsaCodeGenerator codegen, HTypeConversion node) { | 33 SsaCodeGenerator codegen, HTypeConversion node) { |
| 33 StaticUse staticUse = getStaticUse(codegen.compiler); | 34 StaticUse staticUse = getStaticUse(codegen.compiler); |
| 34 codegen.registry.registerStaticUse(staticUse); | 35 codegen.registry.registerStaticUse(staticUse); |
| 35 List<jsAst.Expression> arguments = <jsAst.Expression>[]; | 36 List<jsAst.Expression> arguments = <jsAst.Expression>[]; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 ResolutionDartType type = node.typeExpression; | 134 ResolutionDartType type = node.typeExpression; |
| 134 Element element = type.element; | 135 Element element = type.element; |
| 135 jsAst.Name isField = codegen.backend.namer.operatorIs(element); | 136 jsAst.Name isField = codegen.backend.namer.operatorIs(element); |
| 136 arguments.add(js.quoteName(isField)); | 137 arguments.add(js.quoteName(isField)); |
| 137 codegen.use(node.typeRepresentation); | 138 codegen.use(node.typeRepresentation); |
| 138 arguments.add(codegen.pop()); | 139 arguments.add(codegen.pop()); |
| 139 jsAst.Name asField = codegen.backend.namer.substitutionName(element); | 140 jsAst.Name asField = codegen.backend.namer.substitutionName(element); |
| 140 arguments.add(js.quoteName(asField)); | 141 arguments.add(js.quoteName(asField)); |
| 141 } | 142 } |
| 142 } | 143 } |
| OLD | NEW |