| 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 assert(superclass != null); | 332 assert(superclass != null); |
| 333 // Fix superclass. TODO(sra): make native classes inherit from Interceptor. | 333 // Fix superclass. TODO(sra): make native classes inherit from Interceptor. |
| 334 assert(superclass != compiler.objectClass); | 334 assert(superclass != compiler.objectClass); |
| 335 if (superclass == compiler.objectClass) { | 335 if (superclass == compiler.objectClass) { |
| 336 superclass = backend.jsInterceptorClass; | 336 superclass = backend.jsInterceptorClass; |
| 337 } | 337 } |
| 338 | 338 |
| 339 String superName = backend.namer.getNameOfClass(superclass); | 339 String superName = backend.namer.getNameOfClass(superclass); |
| 340 | 340 |
| 341 ClassBuilder builder = new ClassBuilder(); | 341 ClassBuilder builder = new ClassBuilder(); |
| 342 emitter.emitClassConstructor(classElement, builder); | 342 emitter.emitClassConstructor(classElement, builder, null); |
| 343 emitter.emitSuper(superName, builder); | 343 emitter.emitSuper(superName, builder); |
| 344 bool hasFields = emitter.emitFields( | 344 bool hasFields = emitter.emitFields( |
| 345 classElement, builder, superName, classIsNative: true); | 345 classElement, builder, superName, classIsNative: true); |
| 346 int propertyCount = builder.properties.length; | 346 int propertyCount = builder.properties.length; |
| 347 emitter.emitClassGettersSetters(classElement, builder); | 347 emitter.emitClassGettersSetters(classElement, builder); |
| 348 emitter.emitInstanceMembers(classElement, builder); | 348 emitter.emitInstanceMembers(classElement, builder); |
| 349 emitter.emitIsTests(classElement, builder); | 349 emitter.emitIsTests(classElement, builder); |
| 350 | 350 |
| 351 if (!hasFields && | 351 if (!hasFields && |
| 352 builder.properties.length == propertyCount && | 352 builder.properties.length == propertyCount && |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 if (emitter.compiler.enableMinification) targetBuffer.add(';'); | 533 if (emitter.compiler.enableMinification) targetBuffer.add(';'); |
| 534 targetBuffer.add(jsAst.prettyPrint( | 534 targetBuffer.add(jsAst.prettyPrint( |
| 535 new jsAst.ExpressionStatement(init), compiler)); | 535 new jsAst.ExpressionStatement(init), compiler)); |
| 536 targetBuffer.add('\n'); | 536 targetBuffer.add('\n'); |
| 537 } | 537 } |
| 538 | 538 |
| 539 targetBuffer.add(nativeBuffer); | 539 targetBuffer.add(nativeBuffer); |
| 540 targetBuffer.add('\n'); | 540 targetBuffer.add('\n'); |
| 541 } | 541 } |
| 542 } | 542 } |
| OLD | NEW |