| 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 assert(superclass != null); | 318 assert(superclass != null); |
| 319 // Fix superclass. TODO(sra): make native classes inherit from Interceptor. | 319 // Fix superclass. TODO(sra): make native classes inherit from Interceptor. |
| 320 assert(superclass != compiler.objectClass); | 320 assert(superclass != compiler.objectClass); |
| 321 if (superclass == compiler.objectClass) { | 321 if (superclass == compiler.objectClass) { |
| 322 superclass = backend.jsInterceptorClass; | 322 superclass = backend.jsInterceptorClass; |
| 323 } | 323 } |
| 324 | 324 |
| 325 String superName = backend.namer.getNameOfClass(superclass); | 325 String superName = backend.namer.getNameOfClass(superclass); |
| 326 | 326 |
| 327 ClassBuilder builder = new ClassBuilder(backend.namer); | 327 ClassBuilder builder = new ClassBuilder(backend.namer); |
| 328 emitter.classEmitter.emitClassConstructor(classElement, builder, null); | 328 emitter.classEmitter.emitClassConstructor(classElement, builder); |
| 329 bool hasFields = emitter.classEmitter.emitFields( | 329 bool hasFields = emitter.classEmitter.emitFields( |
| 330 classElement, builder, superName, classIsNative: true); | 330 classElement, builder, superName, classIsNative: true); |
| 331 int propertyCount = builder.properties.length; | 331 int propertyCount = builder.properties.length; |
| 332 emitter.classEmitter.emitClassGettersSetters(classElement, builder); | 332 emitter.classEmitter.emitClassGettersSetters(classElement, builder); |
| 333 emitter.classEmitter.emitInstanceMembers(classElement, builder); | 333 emitter.classEmitter.emitInstanceMembers(classElement, builder); |
| 334 emitter.typeTestEmitter.emitIsTests(classElement, builder); | 334 emitter.typeTestEmitter.emitIsTests(classElement, builder); |
| 335 | 335 |
| 336 if (!hasFields && | 336 if (!hasFields && |
| 337 builder.properties.length == propertyCount && | 337 builder.properties.length == propertyCount && |
| 338 superclass is! MixinApplicationElement) { | 338 superclass is! MixinApplicationElement) { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 if (emitter.compiler.enableMinification) targetBuffer.add(';'); | 488 if (emitter.compiler.enableMinification) targetBuffer.add(';'); |
| 489 targetBuffer.add(jsAst.prettyPrint( | 489 targetBuffer.add(jsAst.prettyPrint( |
| 490 new jsAst.ExpressionStatement(init), compiler)); | 490 new jsAst.ExpressionStatement(init), compiler)); |
| 491 targetBuffer.add('\n'); | 491 targetBuffer.add('\n'); |
| 492 } | 492 } |
| 493 | 493 |
| 494 targetBuffer.add(nativeBuffer); | 494 targetBuffer.add(nativeBuffer); |
| 495 targetBuffer.add('\n'); | 495 targetBuffer.add('\n'); |
| 496 } | 496 } |
| 497 } | 497 } |
| OLD | NEW |