OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Analysis to determine how to generate code for `LookupMap`s. | 5 /// Analysis to determine how to generate code for `LookupMap`s. |
6 library compiler.src.js_backend.lookup_map_analysis; | 6 library compiler.src.js_backend.lookup_map_analysis; |
7 | 7 |
8 import '../common/registry.dart' show Registry; | 8 import '../common/registry.dart' show Registry; |
9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
10 import '../diagnostics/messages.dart' show MessageKind; | 10 import '../diagnostics/messages.dart' show MessageKind; |
11 import '../constants/values.dart' show | 11 import '../constants/values.dart' show |
12 ConstantValue, | 12 ConstantValue, |
13 ConstructedConstantValue, | 13 ConstructedConstantValue, |
14 ListConstantValue, | 14 ListConstantValue, |
15 NullConstantValue, | 15 NullConstantValue, |
16 StringConstantValue, | 16 StringConstantValue, |
17 TypeConstantValue; | 17 TypeConstantValue; |
18 import '../dart_types.dart' show DartType; | 18 import '../dart_types.dart' show DartType; |
19 import '../elements/elements.dart' show | 19 import '../elements/elements.dart' show |
20 ClassElement, | 20 ClassElement, |
21 Element, | 21 Element, |
22 Elements, | 22 Elements, |
23 FieldElement, | 23 FieldElement, |
24 FunctionElement, | 24 FunctionElement, |
25 FunctionSignature, | 25 FunctionSignature, |
26 LibraryElement, | 26 LibraryElement, |
27 VariableElement; | 27 VariableElement; |
28 import '../enqueue.dart' show Enqueuer; | |
29 import 'js_backend.dart' show JavaScriptBackend; | 28 import 'js_backend.dart' show JavaScriptBackend; |
30 import '../dart_types.dart' show DynamicType, InterfaceType; | 29 import '../dart_types.dart' show DynamicType, InterfaceType; |
31 import 'package:pub_semver/pub_semver.dart'; | 30 import 'package:pub_semver/pub_semver.dart'; |
32 | 31 |
33 /// An analysis and optimization to remove unused entries from a `LookupMap`. | 32 /// An analysis and optimization to remove unused entries from a `LookupMap`. |
34 /// | 33 /// |
35 /// `LookupMaps` are defined in `package:lookup_map/lookup_map.dart`. They are | 34 /// `LookupMaps` are defined in `package:lookup_map/lookup_map.dart`. They are |
36 /// simple maps that contain constant expressions as keys, and that only support | 35 /// simple maps that contain constant expressions as keys, and that only support |
37 /// the lookup operation. | 36 /// the lookup operation. |
38 /// | 37 /// |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 } | 430 } |
432 } else { | 431 } else { |
433 original.fields[analysis.entriesField] = | 432 original.fields[analysis.entriesField] = |
434 new ListConstantValue(listType, keyValuePairs); | 433 new ListConstantValue(listType, keyValuePairs); |
435 } | 434 } |
436 } | 435 } |
437 } | 436 } |
438 | 437 |
439 final _validLookupMapVersionConstraint = | 438 final _validLookupMapVersionConstraint = |
440 new VersionConstraint.parse('^0.0.1'); | 439 new VersionConstraint.parse('^0.0.1'); |
OLD | NEW |