| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 /// The element should only be used during the transition to the new model. | 171 /// The element should only be used during the transition to the new model. |
| 172 /// Uses indicate missing information in the model. | 172 /// Uses indicate missing information in the model. |
| 173 final Element element; | 173 final Element element; |
| 174 | 174 |
| 175 final String name; | 175 final String name; |
| 176 final Holder holder; | 176 final Holder holder; |
| 177 Class _superclass; | 177 Class _superclass; |
| 178 final List<Method> methods; | 178 final List<Method> methods; |
| 179 final List<Field> fields; | 179 final List<Field> fields; |
| 180 final List<StubMethod> isChecks; | 180 final List<StubMethod> isChecks; |
| 181 final List<StubMethod> callStubs; |
| 181 final List<Field> staticFieldsForReflection; | 182 final List<Field> staticFieldsForReflection; |
| 182 final bool onlyForRti; | 183 final bool onlyForRti; |
| 183 final bool isDirectlyInstantiated; | 184 final bool isDirectlyInstantiated; |
| 184 final bool isNative; | 185 final bool isNative; |
| 185 | 186 |
| 186 // If the class implements a function type, and the type is encoded in the | 187 // If the class implements a function type, and the type is encoded in the |
| 187 // metatada table, then this field contains the index into that field. | 188 // metatada table, then this field contains the index into that field. |
| 188 final int functionTypeIndex; | 189 final int functionTypeIndex; |
| 189 | 190 |
| 190 /// Whether the class must be evaluated eagerly. | 191 /// Whether the class must be evaluated eagerly. |
| 191 bool isEager = false; | 192 bool isEager = false; |
| 192 | 193 |
| 193 Class(this.element, this.name, this.holder, | 194 Class(this.element, this.name, this.holder, |
| 194 this.methods, | 195 this.methods, |
| 195 this.fields, | 196 this.fields, |
| 196 this.staticFieldsForReflection, | 197 this.staticFieldsForReflection, |
| 198 this.callStubs, |
| 197 this.isChecks, | 199 this.isChecks, |
| 198 this.functionTypeIndex, | 200 this.functionTypeIndex, |
| 199 {this.onlyForRti, | 201 {this.onlyForRti, |
| 200 this.isDirectlyInstantiated, | 202 this.isDirectlyInstantiated, |
| 201 this.isNative}) { | 203 this.isNative}) { |
| 202 assert(onlyForRti != null); | 204 assert(onlyForRti != null); |
| 203 assert(isDirectlyInstantiated != null); | 205 assert(isDirectlyInstantiated != null); |
| 204 assert(isNative != null); | 206 assert(isNative != null); |
| 205 } | 207 } |
| 206 | 208 |
| 207 bool get isMixinApplication => false; | 209 bool get isMixinApplication => false; |
| 208 Class get superclass => _superclass; | 210 Class get superclass => _superclass; |
| 209 | 211 |
| 210 void setSuperclass(Class superclass) { | 212 void setSuperclass(Class superclass) { |
| 211 _superclass = superclass; | 213 _superclass = superclass; |
| 212 } | 214 } |
| 213 | 215 |
| 214 String get superclassName | 216 String get superclassName |
| 215 => (superclass == null) ? "" : superclass.name; | 217 => (superclass == null) ? "" : superclass.name; |
| 216 int get superclassHolderIndex | 218 int get superclassHolderIndex |
| 217 => (superclass == null) ? 0 : superclass.holder.index; | 219 => (superclass == null) ? 0 : superclass.holder.index; |
| 218 } | 220 } |
| 219 | 221 |
| 220 class MixinApplication extends Class { | 222 class MixinApplication extends Class { |
| 221 Class _mixinClass; | 223 Class _mixinClass; |
| 222 | 224 |
| 223 MixinApplication(Element element, String name, Holder holder, | 225 MixinApplication(Element element, String name, Holder holder, |
| 224 List<Field> instanceFields, | 226 List<Field> instanceFields, |
| 225 List<Field> staticFieldsForReflection, | 227 List<Field> staticFieldsForReflection, |
| 228 List<StubMethod> callStubs, |
| 226 List<StubMethod> isChecks, | 229 List<StubMethod> isChecks, |
| 227 int functionTypeIndex, | 230 int functionTypeIndex, |
| 228 {bool onlyForRti, | 231 {bool onlyForRti, |
| 229 bool isDirectlyInstantiated}) | 232 bool isDirectlyInstantiated}) |
| 230 : super(element, | 233 : super(element, |
| 231 name, holder, | 234 name, holder, |
| 232 const <Method>[], | 235 const <Method>[], |
| 233 instanceFields, | 236 instanceFields, |
| 234 staticFieldsForReflection, | 237 staticFieldsForReflection, |
| 238 callStubs, |
| 235 isChecks, functionTypeIndex, | 239 isChecks, functionTypeIndex, |
| 236 onlyForRti: onlyForRti, | 240 onlyForRti: onlyForRti, |
| 237 isDirectlyInstantiated: isDirectlyInstantiated, | 241 isDirectlyInstantiated: isDirectlyInstantiated, |
| 238 isNative: false); | 242 isNative: false); |
| 239 | 243 |
| 240 bool get isMixinApplication => true; | 244 bool get isMixinApplication => true; |
| 241 Class get mixinClass => _mixinClass; | 245 Class get mixinClass => _mixinClass; |
| 242 | 246 |
| 243 void setMixinClass(Class mixinClass) { | 247 void setMixinClass(Class mixinClass) { |
| 244 _mixinClass = mixinClass; | 248 _mixinClass = mixinClass; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 final String name; | 295 final String name; |
| 292 final js.Expression code; | 296 final js.Expression code; |
| 293 final bool needsTearOff; | 297 final bool needsTearOff; |
| 294 | 298 |
| 295 Method(this.element, this.name, this.code, {this.needsTearOff}) { | 299 Method(this.element, this.name, this.code, {this.needsTearOff}) { |
| 296 assert(needsTearOff != null); | 300 assert(needsTearOff != null); |
| 297 } | 301 } |
| 298 } | 302 } |
| 299 | 303 |
| 300 class StubMethod extends Method { | 304 class StubMethod extends Method { |
| 301 StubMethod(String name, js.Expression code, {bool needsTearOff}) | 305 StubMethod(String name, js.Expression code, |
| 302 : super(null, name, code, needsTearOff: needsTearOff); | 306 {bool needsTearOff, Element element }) |
| 307 : super(element, name, code, needsTearOff: needsTearOff); |
| 303 } | 308 } |
| 304 | 309 |
| 305 class StaticMethod extends Method { | 310 class StaticMethod extends Method { |
| 306 final Holder holder; | 311 final Holder holder; |
| 307 StaticMethod(Element element, String name, this.holder, js.Expression code, | 312 StaticMethod(Element element, String name, this.holder, js.Expression code, |
| 308 {bool needsTearOff}) | 313 {bool needsTearOff}) |
| 309 : super(element, name, code, needsTearOff: needsTearOff); | 314 : super(element, name, code, needsTearOff: needsTearOff); |
| 310 } | 315 } |
| 311 | 316 |
| 312 class StaticStubMethod extends StaticMethod { | 317 class StaticStubMethod extends StaticMethod { |
| 313 StaticStubMethod(String name, Holder holder, js.Expression code, | 318 StaticStubMethod(String name, Holder holder, js.Expression code, |
| 314 {bool needsTearOff}) | 319 {bool needsTearOff}) |
| 315 : super(null, name, holder, code, needsTearOff: needsTearOff); | 320 : super(null, name, holder, code, needsTearOff: needsTearOff); |
| 316 } | 321 } |
| OLD | NEW |