OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 js_backend; | 5 part of js_backend; |
6 | 6 |
7 class NativeEmitter { | 7 class NativeEmitter { |
8 | 8 |
9 final Map<Element, ClassBuilder> cachedBuilders; | 9 final Map<Element, ClassBuilder> cachedBuilders; |
10 | 10 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 237 } |
238 | 238 |
239 // Emit the native class interceptors that were actually used. | 239 // Emit the native class interceptors that were actually used. |
240 for (ClassElement classElement in classes) { | 240 for (ClassElement classElement in classes) { |
241 if (!classElement.isNative) continue; | 241 if (!classElement.isNative) continue; |
242 if (neededClasses.contains(classElement)) { | 242 if (neededClasses.contains(classElement)) { |
243 // Define interceptor class for [classElement]. | 243 // Define interceptor class for [classElement]. |
244 emitter.classEmitter.emitClassBuilderWithReflectionData( | 244 emitter.classEmitter.emitClassBuilderWithReflectionData( |
245 backend.namer.getNameOfClass(classElement), | 245 backend.namer.getNameOfClass(classElement), |
246 classElement, builders[classElement], | 246 classElement, builders[classElement], |
247 emitter.getElementDescriptor(classElement)); | 247 emitter.getElementDecriptor(classElement)); |
248 emitter.needsDefineClass = true; | 248 emitter.needsDefineClass = true; |
249 } | 249 } |
250 } | 250 } |
251 } | 251 } |
252 | 252 |
253 /** | 253 /** |
254 * Computes the native classes that are extended (subclassed) by non-native | 254 * Computes the native classes that are extended (subclassed) by non-native |
255 * classes and the set non-mative classes that extend them. (A List is used | 255 * classes and the set non-mative classes that extend them. (A List is used |
256 * instead of a Set for out stability). | 256 * instead of a Set for out stability). |
257 */ | 257 */ |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 if (emitter.compiler.enableMinification) targetBuffer.add(';'); | 470 if (emitter.compiler.enableMinification) targetBuffer.add(';'); |
471 targetBuffer.add(jsAst.prettyPrint( | 471 targetBuffer.add(jsAst.prettyPrint( |
472 new jsAst.ExpressionStatement(init), compiler)); | 472 new jsAst.ExpressionStatement(init), compiler)); |
473 targetBuffer.add('\n'); | 473 targetBuffer.add('\n'); |
474 } | 474 } |
475 | 475 |
476 targetBuffer.add(nativeBuffer); | 476 targetBuffer.add(nativeBuffer); |
477 targetBuffer.add('\n'); | 477 targetBuffer.add('\n'); |
478 } | 478 } |
479 } | 479 } |
OLD | NEW |