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, Name, Literal, | 7 import '../js/js.dart' as js show Expression, Statement, Name, Literal, |
8 TokenFinalizer; | 8 TokenFinalizer; |
9 import '../constants/values.dart' show ConstantValue; | 9 import '../constants/values.dart' show ConstantValue; |
10 | 10 |
11 import '../deferred_load.dart' show OutputUnit; | 11 import '../deferred_load.dart' show OutputUnit; |
12 | 12 |
13 import 'js_emitter.dart' show MetadataCollector, TokenFinalizer; | 13 import 'js_emitter.dart' show MetadataCollector, TokenFinalizer; |
14 | 14 |
15 import '../common.dart'; | 15 import '../common.dart'; |
16 | 16 |
17 class Program { | 17 class Program { |
18 final List<Fragment> fragments; | 18 final List<Fragment> fragments; |
19 final List<Holder> holders; | 19 final List<Holder> holders; |
20 final bool outputContainsConstantList; | 20 final bool outputContainsConstantList; |
21 final bool needsNativeSupport; | 21 final bool needsNativeSupport; |
22 final bool hasIsolateSupport; | 22 final bool hasIsolateSupport; |
23 /// A map from load id to the list of fragments that need to be loaded. | 23 /// A map from load id to the list of fragments that need to be loaded. |
24 final Map<String, List<Fragment>> loadMap; | 24 final Map<String, List<Fragment>> loadMap; |
| 25 /// A map from names to strings. |
| 26 /// |
| 27 /// This map is needed to support `const Symbol` expressions; |
| 28 final Map<js.Name, String> symbolsMap; |
25 | 29 |
26 // If this field is not `null` then its value must be emitted in the embedded | 30 // If this field is not `null` then its value must be emitted in the embedded |
27 // global `TYPE_TO_INTERCEPTOR_MAP`. The map references constants and classes. | 31 // global `TYPE_TO_INTERCEPTOR_MAP`. The map references constants and classes. |
28 final js.Expression typeToInterceptorMap; | 32 final js.Expression typeToInterceptorMap; |
29 | 33 |
30 // TODO(floitsch): we should store the metadata directly instead of storing | 34 // TODO(floitsch): we should store the metadata directly instead of storing |
31 // the collector. However, the old emitter still updates the data. | 35 // the collector. However, the old emitter still updates the data. |
32 final MetadataCollector _metadataCollector; | 36 final MetadataCollector _metadataCollector; |
33 final Iterable<js.TokenFinalizer> finalizers; | 37 final Iterable<js.TokenFinalizer> finalizers; |
34 | 38 |
35 Program(this.fragments, | 39 Program(this.fragments, |
36 this.holders, | 40 this.holders, |
37 this.loadMap, | 41 this.loadMap, |
| 42 this.symbolsMap, |
38 this.typeToInterceptorMap, | 43 this.typeToInterceptorMap, |
39 this._metadataCollector, | 44 this._metadataCollector, |
40 this.finalizers, | 45 this.finalizers, |
41 {this.needsNativeSupport, | 46 {this.needsNativeSupport, |
42 this.outputContainsConstantList, | 47 this.outputContainsConstantList, |
43 this.hasIsolateSupport}) { | 48 this.hasIsolateSupport}) { |
44 assert(needsNativeSupport != null); | 49 assert(needsNativeSupport != null); |
45 assert(outputContainsConstantList != null); | 50 assert(outputContainsConstantList != null); |
46 assert(hasIsolateSupport != null); | 51 assert(hasIsolateSupport != null); |
47 } | 52 } |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 functionType: functionType); | 517 functionType: functionType); |
513 | 518 |
514 bool get isStatic => true; | 519 bool get isStatic => true; |
515 } | 520 } |
516 | 521 |
517 class StaticStubMethod extends StubMethod implements StaticMethod { | 522 class StaticStubMethod extends StubMethod implements StaticMethod { |
518 Holder holder; | 523 Holder holder; |
519 StaticStubMethod(js.Name name, this.holder, js.Expression code) | 524 StaticStubMethod(js.Name name, this.holder, js.Expression code) |
520 : super(name, code); | 525 : super(name, code); |
521 } | 526 } |
OLD | NEW |