| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 /// returned using a type-argument expression. | 278 /// returned using a type-argument expression. |
| 279 void _addGenerics(ResolutionInterfaceType type) { | 279 void _addGenerics(ResolutionInterfaceType type) { |
| 280 if (!type.isGeneric) return; | 280 if (!type.isGeneric) return; |
| 281 for (var arg in type.typeArguments) { | 281 for (var arg in type.typeArguments) { |
| 282 if (arg is ResolutionInterfaceType) { | 282 if (arg is ResolutionInterfaceType) { |
| 283 _addClassUse(arg.element); | 283 _addClassUse(arg.element); |
| 284 // Note: this call was needed to generate correct code for | 284 // Note: this call was needed to generate correct code for |
| 285 // type_lookup_map/generic_type_test | 285 // type_lookup_map/generic_type_test |
| 286 // TODO(sigmund): can we get rid of this? | 286 // TODO(sigmund): can we get rid of this? |
| 287 backend.computeImpactForInstantiatedConstantType( | 287 backend.computeImpactForInstantiatedConstantType( |
| 288 backend.backendClasses.typeImplementation.rawType, | 288 backend.backendClasses.typeType, impactBuilderForCodegen); |
| 289 impactBuilderForCodegen); | |
| 290 _addGenerics(arg); | 289 _addGenerics(arg); |
| 291 } | 290 } |
| 292 } | 291 } |
| 293 } | 292 } |
| 294 | 293 |
| 295 /// Callback from the codegen enqueuer, invoked when a constant (which is | 294 /// Callback from the codegen enqueuer, invoked when a constant (which is |
| 296 /// possibly a const key or a type literal) is used in the program. | 295 /// possibly a const key or a type literal) is used in the program. |
| 297 void registerTypeConstant(ClassElement element) { | 296 void registerTypeConstant(ClassElement element) { |
| 298 if (!_isEnabled || !_inCodegen) return; | 297 if (!_isEnabled || !_inCodegen) return; |
| 299 _addClassUse(element); | 298 _addClassUse(element); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 original.fields[analysis.valueField] = keyValuePairs[1]; | 447 original.fields[analysis.valueField] = keyValuePairs[1]; |
| 449 } | 448 } |
| 450 } else { | 449 } else { |
| 451 original.fields[analysis.entriesField] = | 450 original.fields[analysis.entriesField] = |
| 452 new ListConstantValue(listType, keyValuePairs); | 451 new ListConstantValue(listType, keyValuePairs); |
| 453 } | 452 } |
| 454 } | 453 } |
| 455 } | 454 } |
| 456 | 455 |
| 457 final _validLookupMapVersionConstraint = new VersionConstraint.parse('^0.0.1'); | 456 final _validLookupMapVersionConstraint = new VersionConstraint.parse('^0.0.1'); |
| OLD | NEW |