Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1057)

Unified Diff: pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart

Issue 1301373009: Fix typo in lookup map, use pub_semver to check version constraints in dart2js (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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';
/// 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') {
+ 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');
« no previous file with comments | « no previous file | pkg/compiler/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698