| 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 dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 class NativeEmitter { | 7 class NativeEmitter { |
| 8 | 8 |
| 9 final Map<Element, ClassBuilder> cachedBuilders; | 9 final Map<Element, ClassBuilder> cachedBuilders; |
| 10 | 10 |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } | 275 } |
| 276 | 276 |
| 277 ClassBuilder generateNativeClass(ClassElement classElement) { | 277 ClassBuilder generateNativeClass(ClassElement classElement) { |
| 278 // TODO(sra): Issue #13731- this is commented out as part of custom element | 278 // TODO(sra): Issue #13731- this is commented out as part of custom element |
| 279 // constructor work. | 279 // constructor work. |
| 280 //assert(!classElement.hasBackendMembers); | 280 //assert(!classElement.hasBackendMembers); |
| 281 hasNativeClasses = true; | 281 hasNativeClasses = true; |
| 282 | 282 |
| 283 ClassElement superclass = classElement.superclass; | 283 ClassElement superclass = classElement.superclass; |
| 284 assert(superclass != null); | 284 assert(superclass != null); |
| 285 // Fix superclass. TODO(sra): make native classes inherit from Interceptor. | |
| 286 assert(superclass != compiler.objectClass); | 285 assert(superclass != compiler.objectClass); |
| 287 if (superclass == compiler.objectClass) { | |
| 288 superclass = backend.jsInterceptorClass; | |
| 289 } | |
| 290 | 286 |
| 291 String superName = backend.namer.getNameOfClass(superclass); | 287 String superName = backend.namer.getNameOfClass(superclass); |
| 292 | 288 |
| 293 ClassBuilder builder; | 289 ClassBuilder builder; |
| 294 if (compiler.hasIncrementalSupport) { | 290 if (compiler.hasIncrementalSupport) { |
| 295 builder = cachedBuilders[classElement]; | 291 builder = cachedBuilders[classElement]; |
| 296 if (builder != null) return builder; | 292 if (builder != null) return builder; |
| 297 builder = new ClassBuilder(classElement, backend.namer); | 293 builder = new ClassBuilder(classElement, backend.namer); |
| 298 cachedBuilders[classElement] = builder; | 294 cachedBuilders[classElement] = builder; |
| 299 } else { | 295 } else { |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 targetOutput.add(';'); | 466 targetOutput.add(';'); |
| 471 } | 467 } |
| 472 targetOutput.addBuffer(jsAst.prettyPrint( | 468 targetOutput.addBuffer(jsAst.prettyPrint( |
| 473 new jsAst.ExpressionStatement(init), compiler)); | 469 new jsAst.ExpressionStatement(init), compiler)); |
| 474 targetOutput.add('\n'); | 470 targetOutput.add('\n'); |
| 475 } | 471 } |
| 476 | 472 |
| 477 targetOutput.add('\n'); | 473 targetOutput.add('\n'); |
| 478 } | 474 } |
| 479 } | 475 } |
| OLD | NEW |