| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart2js.new_js_emitter.model; | 5 library dart2js.new_js_emitter.model; |
| 6 | 6 |
| 7 import '../js/js.dart' as js show Expression; | 7 import '../js/js.dart' as js show Expression; |
| 8 import '../constants/values.dart' show ConstantValue; | 8 import '../constants/values.dart' show ConstantValue; |
| 9 | 9 |
| 10 import '../deferred_load.dart' show OutputUnit; | 10 import '../deferred_load.dart' show OutputUnit; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 class Class { | 163 class Class { |
| 164 /// The element should only be used during the transition to the new model. | 164 /// The element should only be used during the transition to the new model. |
| 165 /// Uses indicate missing information in the model. | 165 /// Uses indicate missing information in the model. |
| 166 final Element element; | 166 final Element element; |
| 167 | 167 |
| 168 final String name; | 168 final String name; |
| 169 final Holder holder; | 169 final Holder holder; |
| 170 Class _superclass; | 170 Class _superclass; |
| 171 final List<Method> methods; | 171 final List<Method> methods; |
| 172 final List<InstanceField> fields; | 172 final List<InstanceField> fields; |
| 173 final List<StubMethod> isChecks; |
| 173 final bool onlyForRti; | 174 final bool onlyForRti; |
| 174 final bool isDirectlyInstantiated; | 175 final bool isDirectlyInstantiated; |
| 175 final bool isNative; | 176 final bool isNative; |
| 176 | 177 |
| 178 // If the class implements a function type, and the type is encoded in the |
| 179 // metatada table, then this field contains the index into that field. |
| 180 final int functionTypeIndex; |
| 181 |
| 177 /// Whether the class must be evaluated eagerly. | 182 /// Whether the class must be evaluated eagerly. |
| 178 bool isEager = false; | 183 bool isEager = false; |
| 179 | 184 |
| 180 Class(this.element, | 185 Class(this.element, this.name, this.holder, |
| 181 this.name, this.holder, this.methods, this.fields, | 186 this.methods, |
| 187 this.fields, |
| 188 this.isChecks, |
| 189 this.functionTypeIndex, |
| 182 {this.onlyForRti, | 190 {this.onlyForRti, |
| 183 this.isDirectlyInstantiated, | 191 this.isDirectlyInstantiated, |
| 184 this.isNative}) { | 192 this.isNative}) { |
| 185 assert(onlyForRti != null); | 193 assert(onlyForRti != null); |
| 186 assert(isDirectlyInstantiated != null); | 194 assert(isDirectlyInstantiated != null); |
| 187 assert(isNative != null); | 195 assert(isNative != null); |
| 188 } | 196 } |
| 189 | 197 |
| 190 bool get isMixinApplication => false; | 198 bool get isMixinApplication => false; |
| 191 Class get superclass => _superclass; | 199 Class get superclass => _superclass; |
| 192 | 200 |
| 193 void setSuperclass(Class superclass) { | 201 void setSuperclass(Class superclass) { |
| 194 _superclass = superclass; | 202 _superclass = superclass; |
| 195 } | 203 } |
| 196 | 204 |
| 197 String get superclassName | 205 String get superclassName |
| 198 => (superclass == null) ? "" : superclass.name; | 206 => (superclass == null) ? "" : superclass.name; |
| 199 int get superclassHolderIndex | 207 int get superclassHolderIndex |
| 200 => (superclass == null) ? 0 : superclass.holder.index; | 208 => (superclass == null) ? 0 : superclass.holder.index; |
| 201 } | 209 } |
| 202 | 210 |
| 203 class MixinApplication extends Class { | 211 class MixinApplication extends Class { |
| 204 Class _mixinClass; | 212 Class _mixinClass; |
| 205 | 213 |
| 206 MixinApplication(Element element, | 214 MixinApplication(Element element, String name, Holder holder, |
| 207 String name, Holder holder, | 215 List<StubMethod> isChecks, |
| 208 List<Method> methods, | 216 int functionTypeIndex, |
| 209 List<InstanceField> fields, | |
| 210 {bool onlyForRti, | 217 {bool onlyForRti, |
| 211 bool isDirectlyInstantiated}) | 218 bool isDirectlyInstantiated}) |
| 212 : super(element, | 219 : super(element, |
| 213 name, holder, methods, fields, | 220 name, holder, |
| 221 const <Method>[], const <InstanceField>[], |
| 222 isChecks, functionTypeIndex, |
| 214 onlyForRti: onlyForRti, | 223 onlyForRti: onlyForRti, |
| 215 isDirectlyInstantiated: isDirectlyInstantiated, | 224 isDirectlyInstantiated: isDirectlyInstantiated, |
| 216 isNative: false); | 225 isNative: false); |
| 217 | 226 |
| 218 bool get isMixinApplication => true; | 227 bool get isMixinApplication => true; |
| 219 Class get mixinClass => _mixinClass; | 228 Class get mixinClass => _mixinClass; |
| 220 | 229 |
| 221 void setMixinClass(Class mixinClass) { | 230 void setMixinClass(Class mixinClass) { |
| 222 _mixinClass = mixinClass; | 231 _mixinClass = mixinClass; |
| 223 } | 232 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 StaticMethod(Element element, String name, this.holder, js.Expression code, | 282 StaticMethod(Element element, String name, this.holder, js.Expression code, |
| 274 {bool needsTearOff}) | 283 {bool needsTearOff}) |
| 275 : super(element, name, code, needsTearOff: needsTearOff); | 284 : super(element, name, code, needsTearOff: needsTearOff); |
| 276 } | 285 } |
| 277 | 286 |
| 278 class StaticStubMethod extends StaticMethod { | 287 class StaticStubMethod extends StaticMethod { |
| 279 StaticStubMethod(String name, Holder holder, js.Expression code, | 288 StaticStubMethod(String name, Holder holder, js.Expression code, |
| 280 {bool needsTearOff}) | 289 {bool needsTearOff}) |
| 281 : super(null, name, holder, code, needsTearOff: needsTearOff); | 290 : super(null, name, holder, code, needsTearOff: needsTearOff); |
| 282 } | 291 } |
| OLD | NEW |