| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 ClassElement superclass = classElement.superclass; | 335 ClassElement superclass = classElement.superclass; |
| 336 assert(superclass != null); | 336 assert(superclass != null); |
| 337 // Fix superclass. TODO(sra): make native classes inherit from Interceptor. | 337 // Fix superclass. TODO(sra): make native classes inherit from Interceptor. |
| 338 assert(superclass != compiler.objectClass); | 338 assert(superclass != compiler.objectClass); |
| 339 if (superclass == compiler.objectClass) { | 339 if (superclass == compiler.objectClass) { |
| 340 superclass = backend.jsInterceptorClass; | 340 superclass = backend.jsInterceptorClass; |
| 341 } | 341 } |
| 342 | 342 |
| 343 String superName = backend.namer.getNameOfClass(superclass); | 343 String superName = backend.namer.getNameOfClass(superclass); |
| 344 | 344 |
| 345 ClassBuilder builder = new ClassBuilder(); | 345 ClassBuilder builder = new ClassBuilder(backend.namer); |
| 346 emitter.classEmitter.emitClassConstructor(classElement, builder, null); | 346 emitter.classEmitter.emitClassConstructor(classElement, builder, null); |
| 347 bool hasFields = emitter.classEmitter.emitFields( | 347 bool hasFields = emitter.classEmitter.emitFields( |
| 348 classElement, builder, superName, classIsNative: true); | 348 classElement, builder, superName, classIsNative: true); |
| 349 int propertyCount = builder.properties.length; | 349 int propertyCount = builder.properties.length; |
| 350 emitter.classEmitter.emitClassGettersSetters(classElement, builder); | 350 emitter.classEmitter.emitClassGettersSetters(classElement, builder); |
| 351 emitter.classEmitter.emitInstanceMembers(classElement, builder); | 351 emitter.classEmitter.emitInstanceMembers(classElement, builder); |
| 352 emitter.typeTestEmitter.emitIsTests(classElement, builder); | 352 emitter.typeTestEmitter.emitIsTests(classElement, builder); |
| 353 | 353 |
| 354 if (!hasFields && | 354 if (!hasFields && |
| 355 builder.properties.length == propertyCount && | 355 builder.properties.length == propertyCount && |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 if (emitter.compiler.enableMinification) targetBuffer.add(';'); | 510 if (emitter.compiler.enableMinification) targetBuffer.add(';'); |
| 511 targetBuffer.add(jsAst.prettyPrint( | 511 targetBuffer.add(jsAst.prettyPrint( |
| 512 new jsAst.ExpressionStatement(init), compiler)); | 512 new jsAst.ExpressionStatement(init), compiler)); |
| 513 targetBuffer.add('\n'); | 513 targetBuffer.add('\n'); |
| 514 } | 514 } |
| 515 | 515 |
| 516 targetBuffer.add(nativeBuffer); | 516 targetBuffer.add(nativeBuffer); |
| 517 targetBuffer.add('\n'); | 517 targetBuffer.add('\n'); |
| 518 } | 518 } |
| 519 } | 519 } |
| OLD | NEW |