| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 // Fix superclass. TODO(sra): make native classes inherit from Interceptor. | 251 // Fix superclass. TODO(sra): make native classes inherit from Interceptor. |
| 252 if (superclass == compiler.objectClass) { | 252 if (superclass == compiler.objectClass) { |
| 253 superclass = backend.jsInterceptorClass; | 253 superclass = backend.jsInterceptorClass; |
| 254 } | 254 } |
| 255 | 255 |
| 256 String superName = backend.namer.getName(superclass); | 256 String superName = backend.namer.getName(superclass); |
| 257 | 257 |
| 258 ClassBuilder builder = new ClassBuilder(); | 258 ClassBuilder builder = new ClassBuilder(); |
| 259 emitter.emitClassConstructor(classElement, builder); | 259 emitter.emitClassConstructor(classElement, builder); |
| 260 emitter.emitSuper(superName, builder); | 260 emitter.emitSuper(superName, builder); |
| 261 bool hasFields = emitter.emitClassFields( | 261 bool hasFields = emitter.emitFields( |
| 262 classElement, builder, superName, classIsNative: true); | 262 classElement, builder, superName, classIsNative: true); |
| 263 int propertyCount = builder.properties.length; | 263 int propertyCount = builder.properties.length; |
| 264 emitter.emitClassGettersSetters(classElement, builder); | 264 emitter.emitClassGettersSetters(classElement, builder); |
| 265 emitter.emitInstanceMembers(classElement, builder); | 265 emitter.emitInstanceMembers(classElement, builder); |
| 266 emitter.emitIsTests(classElement, builder); | 266 emitter.emitIsTests(classElement, builder); |
| 267 | 267 |
| 268 if (!hasFields && | 268 if (!hasFields && |
| 269 builder.properties.length == propertyCount && | 269 builder.properties.length == propertyCount && |
| 270 superclass is! MixinApplicationElement) { | 270 superclass is! MixinApplicationElement) { |
| 271 builder.isTrivial = true; | 271 builder.isTrivial = true; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 if (emitter.compiler.enableMinification) targetBuffer.add(';'); | 444 if (emitter.compiler.enableMinification) targetBuffer.add(';'); |
| 445 targetBuffer.add(jsAst.prettyPrint( | 445 targetBuffer.add(jsAst.prettyPrint( |
| 446 new jsAst.ExpressionStatement(init), compiler)); | 446 new jsAst.ExpressionStatement(init), compiler)); |
| 447 targetBuffer.add('\n'); | 447 targetBuffer.add('\n'); |
| 448 } | 448 } |
| 449 | 449 |
| 450 targetBuffer.add(nativeBuffer); | 450 targetBuffer.add(nativeBuffer); |
| 451 targetBuffer.add('\n'); | 451 targetBuffer.add('\n'); |
| 452 } | 452 } |
| 453 } | 453 } |
| OLD | NEW |