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 'package:pub_semver/pub_semver.dart'; | 8 import 'package:pub_semver/pub_semver.dart'; |
9 | 9 |
10 import '../common.dart'; | 10 import '../common.dart'; |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 /// returned using a type-argument expression. | 270 /// returned using a type-argument expression. |
271 void _addGenerics(InterfaceType type) { | 271 void _addGenerics(InterfaceType type) { |
272 if (!type.isGeneric) return; | 272 if (!type.isGeneric) return; |
273 for (var arg in type.typeArguments) { | 273 for (var arg in type.typeArguments) { |
274 if (arg is InterfaceType) { | 274 if (arg is InterfaceType) { |
275 _addClassUse(arg.element); | 275 _addClassUse(arg.element); |
276 // Note: this call was needed to generate correct code for | 276 // Note: this call was needed to generate correct code for |
277 // type_lookup_map/generic_type_test | 277 // type_lookup_map/generic_type_test |
278 // TODO(sigmund): can we get rid of this? | 278 // TODO(sigmund): can we get rid of this? |
279 backend.computeImpactForInstantiatedConstantType( | 279 backend.computeImpactForInstantiatedConstantType( |
280 backend.typeImplementation.rawType, impactBuilder); | 280 backend.backendClasses.typeImplementation.rawType, impactBuilder); |
281 _addGenerics(arg); | 281 _addGenerics(arg); |
282 } | 282 } |
283 } | 283 } |
284 } | 284 } |
285 | 285 |
286 /// Callback from the codegen enqueuer, invoked when a constant (which is | 286 /// Callback from the codegen enqueuer, invoked when a constant (which is |
287 /// possibly a const key or a type literal) is used in the program. | 287 /// possibly a const key or a type literal) is used in the program. |
288 void registerTypeConstant(ClassElement element) { | 288 void registerTypeConstant(ClassElement element) { |
289 if (!_isEnabled || !_inCodegen) return; | 289 if (!_isEnabled || !_inCodegen) return; |
290 _addClassUse(element); | 290 _addClassUse(element); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 original.fields[analysis.valueField] = keyValuePairs[1]; | 439 original.fields[analysis.valueField] = keyValuePairs[1]; |
440 } | 440 } |
441 } else { | 441 } else { |
442 original.fields[analysis.entriesField] = | 442 original.fields[analysis.entriesField] = |
443 new ListConstantValue(listType, keyValuePairs); | 443 new ListConstantValue(listType, keyValuePairs); |
444 } | 444 } |
445 } | 445 } |
446 } | 446 } |
447 | 447 |
448 final _validLookupMapVersionConstraint = new VersionConstraint.parse('^0.0.1'); | 448 final _validLookupMapVersionConstraint = new VersionConstraint.parse('^0.0.1'); |
OLD | NEW |