| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 296 |
| 297 for (ClassElement classElement in classes) { | 297 for (ClassElement classElement in classes) { |
| 298 if (classElement.isNative()) continue; | 298 if (classElement.isNative()) continue; |
| 299 ClassElement nativeAncestor = nativeAncestorOf(classElement); | 299 ClassElement nativeAncestor = nativeAncestorOf(classElement); |
| 300 if (nativeAncestor != null) { | 300 if (nativeAncestor != null) { |
| 301 map | 301 map |
| 302 .putIfAbsent(nativeAncestor, () => <ClassElement>[]) | 302 .putIfAbsent(nativeAncestor, () => <ClassElement>[]) |
| 303 .add(classElement); | 303 .add(classElement); |
| 304 } | 304 } |
| 305 } | 305 } |
| 306 | |
| 307 return map; | 306 return map; |
| 308 } | 307 } |
| 309 | 308 |
| 310 ClassBuilder generateNativeClass(ClassElement classElement) { | 309 ClassBuilder generateNativeClass(ClassElement classElement) { |
| 311 assert(!classElement.hasBackendMembers); | 310 assert(!classElement.hasBackendMembers); |
| 312 nativeClasses.add(classElement); | 311 nativeClasses.add(classElement); |
| 313 | 312 |
| 314 ClassElement superclass = classElement.superclass; | 313 ClassElement superclass = classElement.superclass; |
| 315 assert(superclass != null); | 314 assert(superclass != null); |
| 316 // Fix superclass. TODO(sra): make native classes inherit from Interceptor. | 315 // Fix superclass. TODO(sra): make native classes inherit from Interceptor. |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 if (emitter.compiler.enableMinification) targetBuffer.add(';'); | 519 if (emitter.compiler.enableMinification) targetBuffer.add(';'); |
| 521 targetBuffer.add(jsAst.prettyPrint( | 520 targetBuffer.add(jsAst.prettyPrint( |
| 522 new jsAst.ExpressionStatement(init), compiler)); | 521 new jsAst.ExpressionStatement(init), compiler)); |
| 523 targetBuffer.add('\n'); | 522 targetBuffer.add('\n'); |
| 524 } | 523 } |
| 525 | 524 |
| 526 targetBuffer.add(nativeBuffer); | 525 targetBuffer.add(nativeBuffer); |
| 527 targetBuffer.add('\n'); | 526 targetBuffer.add('\n'); |
| 528 } | 527 } |
| 529 } | 528 } |
| OLD | NEW |