OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.js_emitter.startup_emitter; | 5 library dart2js.js_emitter.startup_emitter; |
6 | 6 |
7 import 'package:js_runtime/shared/embedded_names.dart' show | 7 import 'package:js_runtime/shared/embedded_names.dart' show |
8 JsBuiltin, | 8 JsBuiltin, |
9 METADATA, | 9 METADATA, |
| 10 STATIC_FUNCTION_NAME_TO_CLOSURE, |
10 TYPES; | 11 TYPES; |
11 | 12 |
12 import '../program_builder/program_builder.dart' show ProgramBuilder; | 13 import '../program_builder/program_builder.dart' show ProgramBuilder; |
13 import '../model.dart'; | 14 import '../model.dart'; |
14 import 'model_emitter.dart'; | 15 import 'model_emitter.dart'; |
15 import '../../common.dart'; | 16 import '../../common.dart'; |
16 import '../../elements/elements.dart' show FieldElement; | 17 import '../../elements/elements.dart' show FieldElement; |
17 import '../../js/js.dart' as js; | 18 import '../../js/js.dart' as js; |
18 | 19 |
19 import '../../js_backend/js_backend.dart' show | 20 import '../../js_backend/js_backend.dart' show |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 case JsBuiltin.getMetadata: | 171 case JsBuiltin.getMetadata: |
171 String metadataAccess = | 172 String metadataAccess = |
172 _emitter.generateEmbeddedGlobalAccessString(METADATA); | 173 _emitter.generateEmbeddedGlobalAccessString(METADATA); |
173 return js.js.expressionTemplateFor("$metadataAccess[#]"); | 174 return js.js.expressionTemplateFor("$metadataAccess[#]"); |
174 | 175 |
175 case JsBuiltin.getType: | 176 case JsBuiltin.getType: |
176 String typesAccess = | 177 String typesAccess = |
177 _emitter.generateEmbeddedGlobalAccessString(TYPES); | 178 _emitter.generateEmbeddedGlobalAccessString(TYPES); |
178 return js.js.expressionTemplateFor("$typesAccess[#]"); | 179 return js.js.expressionTemplateFor("$typesAccess[#]"); |
179 | 180 |
| 181 case JsBuiltin.createDartClosureFromNameOfStaticFunction: |
| 182 String functionAccess = _emitter.generateEmbeddedGlobalAccessString( |
| 183 STATIC_FUNCTION_NAME_TO_CLOSURE); |
| 184 return js.js.expressionTemplateFor("$functionAccess(#)"); |
| 185 |
180 default: | 186 default: |
181 _compiler.internalError(NO_LOCATION_SPANNABLE, | 187 _compiler.internalError(NO_LOCATION_SPANNABLE, |
182 "Unhandled Builtin: $builtin"); | 188 "Unhandled Builtin: $builtin"); |
183 return null; | 189 return null; |
184 } | 190 } |
185 } | 191 } |
186 | 192 |
187 @override | 193 @override |
188 void invalidateCaches() { | 194 void invalidateCaches() { |
189 } | 195 } |
190 } | 196 } |
OLD | NEW |