Chromium Code Reviews| Index: pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart |
| diff --git a/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart b/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart |
| index 7be572b6c95e73e2049cdcc84abc6d30bc226ca6..4f372c38ce4dac32196b16edb0869fbf66e035cf 100644 |
| --- a/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart |
| +++ b/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart |
| @@ -28,6 +28,7 @@ import '../elements/elements.dart' show |
| import '../enqueue.dart' show Enqueuer; |
| import 'js_backend.dart' show JavaScriptBackend; |
| import '../dart_types.dart' show DynamicType, InterfaceType; |
| +import 'package:pub_semver/pub_semver.dart'; |
|
Siggi Cherem (dart-lang)
2015/09/08 20:25:34
this is already in DEPS, seems to be a small libra
|
| /// An analysis and optimization to remove unused entries from a `LookupMap`. |
| /// |
| @@ -162,8 +163,12 @@ class LookupMapAnalysis { |
| // TODO(sigmund): add proper version resolution using the pub_semver package |
| // when we introduce the next version. |
| - String version = value.primitiveValue.slowToString(); |
| - if (version != '0.0.1') { |
|
Siggi Cherem (dart-lang)
2015/09/08 20:25:34
I had a feeling this check was not going to last f
|
| + Version version; |
| + try { |
| + version = new Version.parse(value.primitiveValue.slowToString()); |
| + } catch (e) {} |
| + |
| + if (version == null || !_validLookupMapVersionConstraint.allows(version)) { |
| backend.compiler.reportInfo(lookupMapVersionVariable, |
| MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP); |
| return; |
| @@ -430,3 +435,6 @@ class _LookupMapInfo { |
| } |
| } |
| } |
| + |
| +final _validLookupMapVersionConstraint = |
| + new VersionConstraint.parse('^0.0.1'); |