Chromium Code Reviews| 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 CodeEmitterTask emitter; | 9 CodeEmitterTask emitter; |
| 10 CodeBuffer nativeBuffer; | 10 CodeBuffer nativeBuffer; |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 generateDefines(classElement); | 228 generateDefines(classElement); |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 | 231 |
| 232 // Emit the native class interceptors that were actually used. | 232 // Emit the native class interceptors that were actually used. |
| 233 for (ClassElement classElement in classes) { | 233 for (ClassElement classElement in classes) { |
| 234 if (neededClasses.contains(classElement)) { | 234 if (neededClasses.contains(classElement)) { |
| 235 ClassBuilder builder = builders[classElement]; | 235 ClassBuilder builder = builders[classElement]; |
| 236 // Define interceptor class for [classElement]. | 236 // Define interceptor class for [classElement]. |
| 237 String className = backend.namer.getName(classElement); | 237 String className = backend.namer.getName(classElement); |
| 238 jsAst.Expression init = | 238 jsAst.Expression init = |
|
karlklose
2013/07/19 09:29:40
This expression is no longer used, as far as I see
ahe
2013/07/19 10:00:00
Done.
| |
| 239 js(emitter.classesCollector)[className].assign( | 239 js(emitter.classesCollector)[className].assign( |
| 240 builder.toObjectInitializer()); | 240 builder.toObjectInitializer()); |
| 241 mainBuffer.write(jsAst.prettyPrint(init, compiler)); | 241 emitter.emitClassBuilderWithReflectionData( |
| 242 mainBuffer.write('$N$n'); | 242 className, classElement, builder, |
| 243 emitter.bufferForElement(classElement, mainBuffer)); | |
| 243 emitter.needsDefineClass = true; | 244 emitter.needsDefineClass = true; |
| 244 } | 245 } |
| 245 } | 246 } |
| 246 } | 247 } |
| 247 | 248 |
| 248 ClassBuilder generateNativeClass(ClassElement classElement) { | 249 ClassBuilder generateNativeClass(ClassElement classElement) { |
| 249 assert(!classElement.hasBackendMembers); | 250 assert(!classElement.hasBackendMembers); |
| 250 nativeClasses.add(classElement); | 251 nativeClasses.add(classElement); |
| 251 | 252 |
| 252 ClassElement superclass = classElement.superclass; | 253 ClassElement superclass = classElement.superclass; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 447 if (emitter.compiler.enableMinification) targetBuffer.add(';'); | 448 if (emitter.compiler.enableMinification) targetBuffer.add(';'); |
| 448 targetBuffer.add(jsAst.prettyPrint( | 449 targetBuffer.add(jsAst.prettyPrint( |
| 449 new jsAst.ExpressionStatement(init), compiler)); | 450 new jsAst.ExpressionStatement(init), compiler)); |
| 450 targetBuffer.add('\n'); | 451 targetBuffer.add('\n'); |
| 451 } | 452 } |
| 452 | 453 |
| 453 targetBuffer.add(nativeBuffer); | 454 targetBuffer.add(nativeBuffer); |
| 454 targetBuffer.add('\n'); | 455 targetBuffer.add('\n'); |
| 455 } | 456 } |
| 456 } | 457 } |
| OLD | NEW |