| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 ClassEmitter extends CodeEmitterHelper { | 7 class ClassEmitter extends CodeEmitterHelper { |
| 8 | 8 |
| 9 ClassStubGenerator get _stubGenerator => | 9 ClassStubGenerator get _stubGenerator => |
| 10 new ClassStubGenerator(compiler, namer, backend); | 10 new ClassStubGenerator(compiler, namer, backend); |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * Documentation wanted -- johnniwinther | 13 * Documentation wanted -- johnniwinther |
| 14 * | 14 * |
| 15 * Invariant: [classElement] must be a declaration element. | 15 * Invariant: [classElement] must be a declaration element. |
| 16 */ | 16 */ |
| 17 void generateClass(ClassElement classElement, | 17 void generateClass(ClassElement classElement, |
| 18 ClassBuilder properties, | 18 ClassBuilder properties, |
| 19 Map<String, jsAst.Expression> additionalProperties) { | 19 Map<String, jsAst.Expression> additionalProperties) { |
| 20 final onlyForRti = | 20 final onlyForRti = |
| 21 emitter.typeTestEmitter.rtiNeededClasses.contains(classElement); | 21 emitter.typeTestRegistry.rtiNeededClasses.contains(classElement); |
| 22 | 22 |
| 23 assert(invariant(classElement, classElement.isDeclaration)); | 23 assert(invariant(classElement, classElement.isDeclaration)); |
| 24 assert(invariant(classElement, !classElement.isNative || onlyForRti)); | 24 assert(invariant(classElement, !classElement.isNative || onlyForRti)); |
| 25 | 25 |
| 26 emitter.needsDefineClass = true; | 26 emitter.needsDefineClass = true; |
| 27 String className = namer.getNameOfClass(classElement); | 27 String className = namer.getNameOfClass(classElement); |
| 28 | 28 |
| 29 ClassElement superclass = classElement.superclass; | 29 ClassElement superclass = classElement.superclass; |
| 30 String superName = ""; | 30 String superName = ""; |
| 31 if (superclass != null) { | 31 if (superclass != null) { |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); | 600 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); |
| 601 } | 601 } |
| 602 jsAst.Expression convertRtiToRuntimeType = | 602 jsAst.Expression convertRtiToRuntimeType = |
| 603 namer.elementAccess(backend.findHelper('convertRtiToRuntimeType')); | 603 namer.elementAccess(backend.findHelper('convertRtiToRuntimeType')); |
| 604 compiler.dumpInfoTask.registerElementAst(element, | 604 compiler.dumpInfoTask.registerElementAst(element, |
| 605 builder.addProperty(name, | 605 builder.addProperty(name, |
| 606 js('function () { return #(#) }', | 606 js('function () { return #(#) }', |
| 607 [convertRtiToRuntimeType, computeTypeVariable]))); | 607 [convertRtiToRuntimeType, computeTypeVariable]))); |
| 608 } | 608 } |
| 609 } | 609 } |
| OLD | NEW |