| 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; |
| 11 | 11 |
| 12 import 'js_emitter.dart' show MetadataCollector; | 12 import 'js_emitter.dart' show MetadataCollector; |
| 13 | 13 |
| 14 import '../common.dart'; | 14 import '../common.dart'; |
| 15 | 15 |
| 16 class Program { | 16 class Program { |
| 17 final List<Fragment> fragments; | 17 final List<Fragment> fragments; |
| 18 final List<Holder> holders; | 18 final List<Holder> holders; |
| 19 final bool outputContainsConstantList; | 19 final bool outputContainsConstantList; |
| 20 final bool outputContainsNativeClasses; | 20 final bool needsNativeSupport; |
| 21 final bool hasIsolateSupport; | 21 final bool hasIsolateSupport; |
| 22 /// A map from load id to the list of fragments that need to be loaded. | 22 /// A map from load id to the list of fragments that need to be loaded. |
| 23 final Map<String, List<Fragment>> loadMap; | 23 final Map<String, List<Fragment>> loadMap; |
| 24 | 24 |
| 25 // If this field is not `null` then its value must be emitted in the embedded | 25 // If this field is not `null` then its value must be emitted in the embedded |
| 26 // global `TYPE_TO_INTERCEPTOR_MAP`. The map references constants and classes. | 26 // global `TYPE_TO_INTERCEPTOR_MAP`. The map references constants and classes. |
| 27 final js.Expression typeToInterceptorMap; | 27 final js.Expression typeToInterceptorMap; |
| 28 | 28 |
| 29 // TODO(floitsch): we should store the metadata directly instead of storing | 29 // TODO(floitsch): we should store the metadata directly instead of storing |
| 30 // the collector. However, the old emitter still updates the data. | 30 // the collector. However, the old emitter still updates the data. |
| 31 final MetadataCollector _metadataCollector; | 31 final MetadataCollector _metadataCollector; |
| 32 | 32 |
| 33 Program(this.fragments, | 33 Program(this.fragments, |
| 34 this.holders, | 34 this.holders, |
| 35 this.loadMap, | 35 this.loadMap, |
| 36 this.typeToInterceptorMap, | 36 this.typeToInterceptorMap, |
| 37 this._metadataCollector, | 37 this._metadataCollector, |
| 38 {this.outputContainsNativeClasses, | 38 {this.needsNativeSupport, |
| 39 this.outputContainsConstantList, | 39 this.outputContainsConstantList, |
| 40 this.hasIsolateSupport}) { | 40 this.hasIsolateSupport}) { |
| 41 assert(outputContainsNativeClasses != null); | 41 assert(needsNativeSupport != null); |
| 42 assert(outputContainsConstantList != null); | 42 assert(outputContainsConstantList != null); |
| 43 assert(hasIsolateSupport != null); | 43 assert(hasIsolateSupport != null); |
| 44 } | 44 } |
| 45 | 45 |
| 46 /// A list of pretty-printed JavaScript expressions. | 46 /// A list of pretty-printed JavaScript 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 /// |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 requiredParameterCount: requiredParameterCount, | 466 requiredParameterCount: requiredParameterCount, |
| 467 optionalParameterDefaultValues: optionalParameterDefaultValues, | 467 optionalParameterDefaultValues: optionalParameterDefaultValues, |
| 468 functionType: functionType); | 468 functionType: functionType); |
| 469 } | 469 } |
| 470 | 470 |
| 471 class StaticStubMethod extends StubMethod implements StaticMethod { | 471 class StaticStubMethod extends StubMethod implements StaticMethod { |
| 472 Holder holder; | 472 Holder holder; |
| 473 StaticStubMethod(String name, this.holder, js.Expression code) | 473 StaticStubMethod(String name, this.holder, js.Expression code) |
| 474 : super(name, code); | 474 : super(name, code); |
| 475 } | 475 } |
| OLD | NEW |