| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 assert(superclass != null); | 288 assert(superclass != null); |
| 289 // Fix superclass. TODO(sra): make native classes inherit from Interceptor. | 289 // Fix superclass. TODO(sra): make native classes inherit from Interceptor. |
| 290 assert(superclass != compiler.objectClass); | 290 assert(superclass != compiler.objectClass); |
| 291 if (superclass == compiler.objectClass) { | 291 if (superclass == compiler.objectClass) { |
| 292 superclass = backend.jsInterceptorClass; | 292 superclass = backend.jsInterceptorClass; |
| 293 } | 293 } |
| 294 | 294 |
| 295 String superName = backend.namer.getNameOfClass(superclass); | 295 String superName = backend.namer.getNameOfClass(superclass); |
| 296 | 296 |
| 297 ClassBuilder builder = new ClassBuilder(backend.namer); | 297 ClassBuilder builder = new ClassBuilder(backend.namer); |
| 298 emitter.classEmitter.emitClassConstructor(classElement, builder, null); | 298 emitter.classEmitter.emitClassConstructor(classElement, builder); |
| 299 bool hasFields = emitter.classEmitter.emitFields( | 299 bool hasFields = emitter.classEmitter.emitFields( |
| 300 classElement, builder, superName, classIsNative: true); | 300 classElement, builder, superName, classIsNative: true); |
| 301 int propertyCount = builder.properties.length; | 301 int propertyCount = builder.properties.length; |
| 302 emitter.classEmitter.emitClassGettersSetters(classElement, builder); | 302 emitter.classEmitter.emitClassGettersSetters(classElement, builder); |
| 303 emitter.classEmitter.emitInstanceMembers(classElement, builder); | 303 emitter.classEmitter.emitInstanceMembers(classElement, builder); |
| 304 emitter.typeTestEmitter.emitIsTests(classElement, builder); | 304 emitter.typeTestEmitter.emitIsTests(classElement, builder); |
| 305 | 305 |
| 306 if (!hasFields && | 306 if (!hasFields && |
| 307 builder.properties.length == propertyCount && | 307 builder.properties.length == propertyCount && |
| 308 superclass is! MixinApplicationElement) { | 308 superclass is! MixinApplicationElement) { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 if (emitter.compiler.enableMinification) targetBuffer.add(';'); | 458 if (emitter.compiler.enableMinification) targetBuffer.add(';'); |
| 459 targetBuffer.add(jsAst.prettyPrint( | 459 targetBuffer.add(jsAst.prettyPrint( |
| 460 new jsAst.ExpressionStatement(init), compiler)); | 460 new jsAst.ExpressionStatement(init), compiler)); |
| 461 targetBuffer.add('\n'); | 461 targetBuffer.add('\n'); |
| 462 } | 462 } |
| 463 | 463 |
| 464 targetBuffer.add(nativeBuffer); | 464 targetBuffer.add(nativeBuffer); |
| 465 targetBuffer.add('\n'); | 465 targetBuffer.add('\n'); |
| 466 } | 466 } |
| 467 } | 467 } |
| OLD | NEW |