Chromium Code Reviews| 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, Statement; | 7 import '../js/js.dart' as js show Expression, Statement; |
| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 /// A list of metadata expressions. | 46 /// A list of metadata expressions. |
| 47 /// | 47 /// |
| 48 /// This list must be emitted in the `METADATA` embedded global. | 48 /// This list must be emitted in the `METADATA` embedded global. |
| 49 /// The list references constants and must hence be emitted after constants | 49 /// The list references constants and must hence be emitted after constants |
| 50 /// have been initialized. | 50 /// have been initialized. |
| 51 /// | 51 /// |
| 52 /// Note: the metadata is derived from the task's `metadataCollector`. The | 52 /// Note: the metadata is derived from the task's `metadataCollector`. The |
| 53 /// list must not be emitted before all operations on it are done. For | 53 /// list must not be emitted before all operations on it are done. For |
| 54 /// example, the old emitter generates metadata when emitting reflection | 54 /// example, the old emitter generates metadata when emitting reflection |
| 55 /// data. | 55 /// data. |
| 56 List<js.Expression> get metadata => _metadataCollector.globalMetadata; | 56 js.Expression get metadata => _metadataCollector.globalMetadata; |
| 57 | 57 |
| 58 /// A map with lists of type expressions. | 58 /// Getter for the list of metadata entries for a given [OutputUnit]. |
|
karlklose
2015/05/28 09:39:53
Is is not a getter...
herhut
2015/06/01 12:09:42
Done.
| |
| 59 /// | 59 /// |
| 60 /// There is one list for each output unit. The list belonging to the main | 60 /// There is one list for each output unit. The list belonging to the main |
| 61 /// unit must be emitted in the `TYPES` embedded global. The list references | 61 /// unit must be emitted in the `TYPES` embedded global. The list references |
| 62 /// constants and must hence be emitted after constants have been initialized. | 62 /// constants and must hence be emitted after constants have been initialized. |
| 63 /// | 63 /// |
| 64 /// Note: the metadata is derived from the task's `metadataCollector`. The | 64 /// Note: the metadata is derived from the task's `metadataCollector`. The |
| 65 /// list must not be emitted before all operations on it are done. For | 65 /// list is only a placeholder and will be filled in once metadata collection |
| 66 /// example, the old emitter generates metadata when emitting reflection | 66 /// is finalized. |
| 67 /// data. | 67 js.Expression metadataTypesForOutputUnit(OutputUnit unit) |
| 68 Map<OutputUnit, List<js.Expression>> get metadataTypes | 68 => _metadataCollector.getTypesForOutputUnit(unit); |
|
karlklose
2015/05/28 09:39:53
Use {} and return when it does not fit on one line
herhut
2015/06/01 12:09:42
Agree, I inherited this.
| |
| 69 => _metadataCollector.types; | |
| 70 | 69 |
| 71 | 70 |
| 72 bool get isSplit => fragments.length > 1; | 71 bool get isSplit => fragments.length > 1; |
| 73 Iterable<Fragment> get deferredFragments => fragments.skip(1); | 72 Iterable<Fragment> get deferredFragments => fragments.skip(1); |
| 74 Fragment get mainFragment => fragments.first; | 73 Fragment get mainFragment => fragments.first; |
| 75 } | 74 } |
| 76 | 75 |
| 77 /** | 76 /** |
| 78 * This class represents a JavaScript object that contains static state, like | 77 * This class represents a JavaScript object that contains static state, like |
| 79 * classes or functions. | 78 * classes or functions. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 | 228 |
| 230 /// noSuchMethod stubs in the special case that the class is Object. | 229 /// noSuchMethod stubs in the special case that the class is Object. |
| 231 final List<StubMethod> noSuchMethodStubs; | 230 final List<StubMethod> noSuchMethodStubs; |
| 232 final List<Field> staticFieldsForReflection; | 231 final List<Field> staticFieldsForReflection; |
| 233 final bool onlyForRti; | 232 final bool onlyForRti; |
| 234 final bool isDirectlyInstantiated; | 233 final bool isDirectlyInstantiated; |
| 235 final bool isNative; | 234 final bool isNative; |
| 236 | 235 |
| 237 // If the class implements a function type, and the type is encoded in the | 236 // If the class implements a function type, and the type is encoded in the |
| 238 // metatada table, then this field contains the index into that field. | 237 // metatada table, then this field contains the index into that field. |
| 239 final int functionTypeIndex; | 238 final js.Expression functionTypeIndex; |
|
sra1
2015/05/27 19:38:51
Could this be js.TokenNumber ?
herhut
2015/06/01 12:09:42
I don't want to expose the fact that the result is
| |
| 240 | 239 |
| 241 /// Whether the class must be evaluated eagerly. | 240 /// Whether the class must be evaluated eagerly. |
| 242 bool isEager = false; | 241 bool isEager = false; |
| 243 | 242 |
| 244 /// Data that must be emitted with the class for native interop. | 243 /// Data that must be emitted with the class for native interop. |
| 245 String nativeInfo; | 244 String nativeInfo; |
| 246 | 245 |
| 247 Class(this.element, this.name, this.holder, | 246 Class(this.element, this.name, this.holder, |
| 248 this.methods, | 247 this.methods, |
| 249 this.fields, | 248 this.fields, |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 276 | 275 |
| 277 class MixinApplication extends Class { | 276 class MixinApplication extends Class { |
| 278 Class _mixinClass; | 277 Class _mixinClass; |
| 279 | 278 |
| 280 MixinApplication(Element element, String name, Holder holder, | 279 MixinApplication(Element element, String name, Holder holder, |
| 281 List<Field> instanceFields, | 280 List<Field> instanceFields, |
| 282 List<Field> staticFieldsForReflection, | 281 List<Field> staticFieldsForReflection, |
| 283 List<StubMethod> callStubs, | 282 List<StubMethod> callStubs, |
| 284 List<StubMethod> typeVariableReaderStubs, | 283 List<StubMethod> typeVariableReaderStubs, |
| 285 List<StubMethod> isChecks, | 284 List<StubMethod> isChecks, |
| 286 int functionTypeIndex, | 285 js.Expression functionTypeIndex, |
| 287 {bool onlyForRti, | 286 {bool onlyForRti, |
| 288 bool isDirectlyInstantiated}) | 287 bool isDirectlyInstantiated}) |
| 289 : super(element, | 288 : super(element, |
| 290 name, holder, | 289 name, holder, |
| 291 const <Method>[], | 290 const <Method>[], |
| 292 instanceFields, | 291 instanceFields, |
| 293 staticFieldsForReflection, | 292 staticFieldsForReflection, |
| 294 callStubs, | 293 callStubs, |
| 295 typeVariableReaderStubs, | 294 typeVariableReaderStubs, |
| 296 const <StubMethod>[], | 295 const <StubMethod>[], |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 481 requiredParameterCount: requiredParameterCount, | 480 requiredParameterCount: requiredParameterCount, |
| 482 optionalParameterDefaultValues: optionalParameterDefaultValues, | 481 optionalParameterDefaultValues: optionalParameterDefaultValues, |
| 483 functionType: functionType); | 482 functionType: functionType); |
| 484 } | 483 } |
| 485 | 484 |
| 486 class StaticStubMethod extends StubMethod implements StaticMethod { | 485 class StaticStubMethod extends StubMethod implements StaticMethod { |
| 487 Holder holder; | 486 Holder holder; |
| 488 StaticStubMethod(String name, this.holder, js.Expression code) | 487 StaticStubMethod(String name, this.holder, js.Expression code) |
| 489 : super(name, code); | 488 : super(name, code); |
| 490 } | 489 } |
| OLD | NEW |