| 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; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 class InterceptorEmitter extends CodeEmitterHelper { | 7 class InterceptorEmitter extends CodeEmitterHelper { |
| 8 final Set<String> interceptorInvocationNames = new Set<String>(); | 8 final Set<String> interceptorInvocationNames = new Set<String>(); |
| 9 | 9 |
| 10 void recordMangledNameOfMemberMethod(FunctionElement member, String name) { | 10 void recordMangledNameOfMemberMethod(FunctionElement member, String name) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 properties[i] = new jsAst.Property(js.string(name), js.number(1)); | 80 properties[i] = new jsAst.Property(js.string(name), js.number(1)); |
| 81 } | 81 } |
| 82 return new jsAst.ObjectInitializer(properties, isOneLiner: true); | 82 return new jsAst.ObjectInitializer(properties, isOneLiner: true); |
| 83 } | 83 } |
| 84 | 84 |
| 85 /** | 85 /** |
| 86 * Emit initializer for `typeToInterceptorMap` data structure used by | 86 * Emit initializer for `typeToInterceptorMap` data structure used by |
| 87 * `findInterceptorForType`. See declaration of `typeToInterceptor` in | 87 * `findInterceptorForType`. See declaration of `typeToInterceptor` in |
| 88 * `interceptors.dart`. | 88 * `interceptors.dart`. |
| 89 */ | 89 */ |
| 90 void emitTypeToInterceptorMap(CodeOutput output) { | 90 void emitTypeToInterceptorMap(Program program, CodeOutput output) { |
| 91 InterceptorStubGenerator stubGenerator = | 91 jsAst.Expression array = program.typeToInterceptorMap; |
| 92 new InterceptorStubGenerator(compiler, namer, backend); | |
| 93 jsAst.Expression array = stubGenerator.generateTypeToInterceptorMap(); | |
| 94 if (array == null) return; | 92 if (array == null) return; |
| 95 | 93 |
| 96 jsAst.Expression typeToInterceptorMap = emitter | 94 jsAst.Expression typeToInterceptorMap = emitter |
| 97 .generateEmbeddedGlobalAccess(embeddedNames.TYPE_TO_INTERCEPTOR_MAP); | 95 .generateEmbeddedGlobalAccess(embeddedNames.TYPE_TO_INTERCEPTOR_MAP); |
| 98 jsAst.Expression assignment = js('# = #', [typeToInterceptorMap, array]); | 96 jsAst.Expression assignment = js('# = #', [typeToInterceptorMap, array]); |
| 99 | 97 |
| 100 output.addBuffer(jsAst.prettyPrint(assignment, compiler)); | 98 output.addBuffer(jsAst.prettyPrint(assignment, compiler)); |
| 101 output.add(N); | 99 output.add(N); |
| 102 } | 100 } |
| 103 } | 101 } |
| OLD | NEW |