Roll engine to 76cb311d9c33720dcd19274228b39ecdbad8d9af (with rolled dart) (#16518)
* Handle error count reported by frontend.
Extend compilation result from single string to a structure(string filename and integer error count).
* Use ?.
* Include engine roll with dart sdk roll.
* parse(onError) -> tryParse
* Make '?? throw' more readable and avoid issue with analyzer
* Fix test so it mocks compiler output including errors count
diff --git a/dev/bots/analyze-sample-code.dart b/dev/bots/analyze-sample-code.dart
index 4b46108..c27adb5 100644
--- a/dev/bots/analyze-sample-code.dart
+++ b/dev/bots/analyze-sample-code.dart
@@ -238,8 +238,14 @@
throw 'failed to parse error message: $error';
}
final String column = error.substring(colon2 + kColon.length, bullet2);
- final int lineNumber = int.parse(line, radix: 10, onError: (String source) => throw 'failed to parse error message: $error');
- final int columnNumber = int.parse(column, radix: 10, onError: (String source) => throw 'failed to parse error message: $error');
+ final int lineNumber = int.tryParse(line, radix: 10);
+ if (lineNumber == null) {
+ throw 'failed to parse error message: $error';
+ }
+ final int columnNumber = int.tryParse(column, radix: 10);
+ if (columnNumber == null) {
+ throw 'failed to parse error message: $error';
+ }
if (lineNumber < 1 || lineNumber > lines.length) {
keepMain = true;
throw 'failed to parse error message (read line number as $lineNumber; total number of lines is ${lines.length}): $error';