| 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 part of dart2js.js_emitter.full_emitter; |
| 6 | 6 |
| 7 class InterceptorEmitter extends CodeEmitterHelper { | 7 class InterceptorEmitter extends CodeEmitterHelper { |
| 8 final ClosedWorld closedWorld; | 8 final ClosedWorld closedWorld; |
| 9 final Set<jsAst.Name> interceptorInvocationNames = new Set<jsAst.Name>(); | 9 final Set<jsAst.Name> interceptorInvocationNames = new Set<jsAst.Name>(); |
| 10 | 10 |
| 11 InterceptorEmitter(this.closedWorld); | 11 InterceptorEmitter(this.closedWorld); |
| 12 | 12 |
| 13 void recordMangledNameOfMemberMethod( | 13 void recordMangledNameOfMemberMethod(MethodElement member, jsAst.Name name) { |
| 14 FunctionElement member, jsAst.Name name) { | |
| 15 if (backend.isInterceptedMethod(member)) { | 14 if (backend.isInterceptedMethod(member)) { |
| 16 interceptorInvocationNames.add(name); | 15 interceptorInvocationNames.add(name); |
| 17 } | 16 } |
| 18 } | 17 } |
| 19 | 18 |
| 20 jsAst.Expression buildGetInterceptorMethod( | 19 jsAst.Expression buildGetInterceptorMethod( |
| 21 jsAst.Name key, Set<ClassElement> classes) { | 20 jsAst.Name key, Set<ClassElement> classes) { |
| 22 InterceptorStubGenerator stubGenerator = | 21 InterceptorStubGenerator stubGenerator = |
| 23 new InterceptorStubGenerator(compiler, namer, backend, closedWorld); | 22 new InterceptorStubGenerator(compiler, namer, backend, closedWorld); |
| 24 jsAst.Expression function = | 23 jsAst.Expression function = |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 */ | 96 */ |
| 98 jsAst.Statement buildTypeToInterceptorMap(Program program) { | 97 jsAst.Statement buildTypeToInterceptorMap(Program program) { |
| 99 jsAst.Expression array = program.typeToInterceptorMap; | 98 jsAst.Expression array = program.typeToInterceptorMap; |
| 100 if (array == null) return js.comment("Empty type-to-interceptor map."); | 99 if (array == null) return js.comment("Empty type-to-interceptor map."); |
| 101 | 100 |
| 102 jsAst.Expression typeToInterceptorMap = emitter | 101 jsAst.Expression typeToInterceptorMap = emitter |
| 103 .generateEmbeddedGlobalAccess(embeddedNames.TYPE_TO_INTERCEPTOR_MAP); | 102 .generateEmbeddedGlobalAccess(embeddedNames.TYPE_TO_INTERCEPTOR_MAP); |
| 104 return js.statement('# = #', [typeToInterceptorMap, array]); | 103 return js.statement('# = #', [typeToInterceptorMap, array]); |
| 105 } | 104 } |
| 106 } | 105 } |
| OLD | NEW |