| 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 * Documentation wanted -- johnniwinther | 9 * Documentation wanted -- johnniwinther |
| 10 * | 10 * |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 /// Returns `true` if fields added. | 92 /// Returns `true` if fields added. |
| 93 bool emitFields(Element element, | 93 bool emitFields(Element element, |
| 94 ClassBuilder builder, | 94 ClassBuilder builder, |
| 95 String superName, | 95 String superName, |
| 96 { bool classIsNative: false, | 96 { bool classIsNative: false, |
| 97 bool emitStatics: false, | 97 bool emitStatics: false, |
| 98 bool onlyForRti: false }) { | 98 bool onlyForRti: false }) { |
| 99 assert(!emitStatics || !onlyForRti); | 99 assert(!emitStatics || !onlyForRti); |
| 100 bool isClass = false; | |
| 101 bool isLibrary = false; | |
| 102 if (element.isClass()) { | 100 if (element.isClass()) { |
| 103 isClass = true; | |
| 104 } else if (element.isLibrary()) { | 101 } else if (element.isLibrary()) { |
| 105 isLibrary = false; | |
| 106 assert(invariant(element, emitStatics)); | 102 assert(invariant(element, emitStatics)); |
| 107 } else { | 103 } else { |
| 108 throw new SpannableAssertionFailure( | 104 throw new SpannableAssertionFailure( |
| 109 element, 'Must be a ClassElement or a LibraryElement'); | 105 element, 'Must be a ClassElement or a LibraryElement'); |
| 110 } | 106 } |
| 111 if (emitStatics) { | 107 if (emitStatics) { |
| 112 assert(invariant(element, superName == null, message: superName)); | 108 assert(invariant(element, superName == null, message: superName)); |
| 113 } else { | 109 } else { |
| 114 assert(invariant(element, superName != null)); | 110 assert(invariant(element, superName != null)); |
| 115 String nativeName = | 111 String nativeName = |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 computeTypeVariable = | 596 computeTypeVariable = |
| 601 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); | 597 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); |
| 602 } | 598 } |
| 603 jsAst.Expression convertRtiToRuntimeType = | 599 jsAst.Expression convertRtiToRuntimeType = |
| 604 namer.elementAccess(compiler.findHelper('convertRtiToRuntimeType')); | 600 namer.elementAccess(compiler.findHelper('convertRtiToRuntimeType')); |
| 605 builder.addProperty( | 601 builder.addProperty( |
| 606 name, js.fun( | 602 name, js.fun( |
| 607 [], [js.return_(convertRtiToRuntimeType(computeTypeVariable))])); | 603 [], [js.return_(convertRtiToRuntimeType(computeTypeVariable))])); |
| 608 } | 604 } |
| 609 } | 605 } |
| OLD | NEW |