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

Unified Diff: benchmark/lib/report.dart

Issue 1829573002: Fix all strong mode warnings in protoc-plugin (Closed) Base URL: git@github.com:dart-lang/dart-protoc-plugin.git@master
Patch Set: Created 4 years, 9 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
Index: benchmark/lib/report.dart
diff --git a/benchmark/lib/report.dart b/benchmark/lib/report.dart
index aa3ec4dc86827aca5138455e0ad6e168d616f374..0eed2397a72579cc0c6bbfa8a11ca7a7227887cb 100644
--- a/benchmark/lib/report.dart
+++ b/benchmark/lib/report.dart
@@ -66,12 +66,14 @@ pb.Packages createPackages(String pubspecYaml, String pubspecLock) {
/// Quick and dirty lock file parser.
/// - ignores indentation
/// - assumes one top-level key "packages:"
-/// - assumes all other lines without a value start a new package
-/// - only allows three known keys within a package
+/// - assumes all other lines without a value except 'description'
+/// start a new package
+/// - only allows known keys within a package
List<pb.PackageVersion> _parseLockFile(String contents) {
var out = <pb.PackageVersion>[];
bool inPackages = false;
+ bool inDescription = false;
pb.PackageVersion pv = null;
var lineNumber = 0;
for (var line in contents.split("\n")) {
@@ -99,15 +101,22 @@ List<pb.PackageVersion> _parseLockFile(String contents) {
}
if (value == "") {
+ if (key == "description") {
+ inDescription = true;
+ continue;
+ }
if (pv != null) out.add(pv);
pv = new pb.PackageVersion()..name = key;
continue;
}
if (pv == null) {
- throw "can't parse pubspec.lock at line $lineNumber";
+ throw "can't parse pubspec.lock at line $lineNumber - no value for $key";
}
+ if (inDescription && (key == "name" || key == "url")) continue;
+ inDescription = false;
+
switch (key) {
case "description":
break;
@@ -122,8 +131,10 @@ List<pb.PackageVersion> _parseLockFile(String contents) {
break;
case "relative":
break; // ignore
+ case "sdk":
+ break; // ignore
default:
- throw "can't parse pubspec.lock at line $lineNumber";
+ throw "can't parse pubspec.lock at line $lineNumber - unknown key $key";
}
}
return out;

Powered by Google App Engine
This is Rietveld 408576698