| 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 part of dart2js.js_emitter.full_emitter; | 5 library dart2js.js_emitter.full_emitter.interceptor_emitter; |
| 6 |
| 7 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
| 8 import '../../elements/elements.dart' |
| 9 show |
| 10 ClassElement, |
| 11 MethodElement; |
| 12 import '../../js/js.dart' as jsAst; |
| 13 import '../../js/js.dart' show js; |
| 14 import '../../world.dart' show ClosedWorld; |
| 15 import '../js_emitter.dart' hide Emitter, EmitterFactory; |
| 16 import '../model.dart'; |
| 17 import 'emitter.dart'; |
| 6 | 18 |
| 7 class InterceptorEmitter extends CodeEmitterHelper { | 19 class InterceptorEmitter extends CodeEmitterHelper { |
| 8 final ClosedWorld closedWorld; | 20 final ClosedWorld closedWorld; |
| 9 final Set<jsAst.Name> interceptorInvocationNames = new Set<jsAst.Name>(); | 21 final Set<jsAst.Name> interceptorInvocationNames = new Set<jsAst.Name>(); |
| 10 | 22 |
| 11 InterceptorEmitter(this.closedWorld); | 23 InterceptorEmitter(this.closedWorld); |
| 12 | 24 |
| 13 void recordMangledNameOfMemberMethod(MethodElement member, jsAst.Name name) { | 25 void recordMangledNameOfMemberMethod(MethodElement member, jsAst.Name name) { |
| 14 if (backend.isInterceptedMethod(member)) { | 26 if (backend.isInterceptedMethod(member)) { |
| 15 interceptorInvocationNames.add(name); | 27 interceptorInvocationNames.add(name); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 */ | 108 */ |
| 97 jsAst.Statement buildTypeToInterceptorMap(Program program) { | 109 jsAst.Statement buildTypeToInterceptorMap(Program program) { |
| 98 jsAst.Expression array = program.typeToInterceptorMap; | 110 jsAst.Expression array = program.typeToInterceptorMap; |
| 99 if (array == null) return js.comment("Empty type-to-interceptor map."); | 111 if (array == null) return js.comment("Empty type-to-interceptor map."); |
| 100 | 112 |
| 101 jsAst.Expression typeToInterceptorMap = emitter | 113 jsAst.Expression typeToInterceptorMap = emitter |
| 102 .generateEmbeddedGlobalAccess(embeddedNames.TYPE_TO_INTERCEPTOR_MAP); | 114 .generateEmbeddedGlobalAccess(embeddedNames.TYPE_TO_INTERCEPTOR_MAP); |
| 103 return js.statement('# = #', [typeToInterceptorMap, array]); | 115 return js.statement('# = #', [typeToInterceptorMap, array]); |
| 104 } | 116 } |
| 105 } | 117 } |
| OLD | NEW |