Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 41cf79f

Browse files
johnniwinthercommit-bot@chromium.org
authored andcommitted
[cfe] Migrate tools that do not depend on package:vm
Change-Id: I1cc29637bcc01880d56963447c1d34028e6c8504 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207139 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
1 parent 9ee2259 commit 41cf79f

File tree

7 files changed

+13
-26
lines changed

7 files changed

+13
-26
lines changed

pkg/front_end/test/simple_stats.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE.md file.
44

5-
// @dart = 2.9
6-
75
import 'dart:math' as math;
86

97
class SimpleTTestStat {
108
static TTestResult ttest<E extends num>(List<E> a, List<E> b) {
11-
E aSum = a.reduce((value, element) => (value + element));
12-
E bSum = b.reduce((value, element) => (value + element));
9+
E aSum = a.reduce((value, element) => (value + element) as E);
10+
E bSum = b.reduce((value, element) => (value + element) as E);
1311
int aCount = a.length;
1412
int bCount = b.length;
1513
double aMean = aSum / aCount;
@@ -37,7 +35,7 @@ class SimpleTTestStat {
3735
}
3836

3937
static double variance<E extends num>(List<E> data) {
40-
E sum = data.reduce((value, element) => (value + element));
38+
E sum = data.reduce((value, element) => (value + element) as E);
4139
int count = data.length;
4240
double average = sum / count;
4341

pkg/front_end/tool/_fasta/log_analyzer.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// @dart=2.9
6-
75
import 'dart:convert' show jsonDecode, jsonEncode;
86

97
import 'dart:io';

pkg/front_end/tool/fasta.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// @dart=2.9
6-
75
import 'dart:io';
86

97
import '../test/utils/io_utils.dart' show computeRepoDir;
@@ -95,7 +93,7 @@ main(List<String> args) async {
9593
exitCode = await process.exitCode;
9694
}
9795

98-
void stop(String message) {
96+
Never stop(String message) {
9997
stderr.write(message);
10098
exit(2);
10199
}

pkg/front_end/tool/smoke_test_quick.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// @dart=2.9
6-
75
import 'dart:io' show Platform, Process, ProcessResult, exitCode;
86

97
import '../test/utils/io_utils.dart' show computeRepoDir;

pkg/front_end/tool/stat_on_dash_v.dart

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// @dart=2.9
6-
75
import "dart:io";
86

97
import "../test/simple_stats.dart";
108

11-
void usage([String extraMessage]) {
9+
void usage([String? extraMessage]) {
1210
print("Usage:");
1311
print("On Linux via bash you can do something like");
1412
print("dart pkg/front_end/tool/stat_on_dash_v.dart \ "
@@ -68,12 +66,12 @@ main(List<String> args) {
6866

6967
bool printedAnything = false;
7068
for (String part in data.keys) {
71-
Map<String, List<int>> partData = data[part];
72-
List<int> prevRuntimes;
73-
String prevGroup;
69+
Map<String, List<int>> partData = data[part]!;
70+
List<int>? prevRuntimes;
71+
String? prevGroup;
7472
bool printed = false;
7573
for (String group in allGroups) {
76-
List<int> runtimes = partData[group];
74+
List<int>? runtimes = partData[group];
7775
if (runtimes == null) {
7876
// Fake it to be a small list of 0s.
7977
runtimes = new List<int>.filled(5, 0);
@@ -101,7 +99,8 @@ main(List<String> args) {
10199
leastConfidentChange = result.diff - result.confidence;
102100
}
103101

104-
combinedChange["$prevGroup => $group"] += leastConfidentChange;
102+
combinedChange["$prevGroup => $group"] =
103+
combinedChange["$prevGroup => $group"]! + leastConfidentChange;
105104
}
106105
}
107106
prevRuntimes = runtimes;
@@ -115,7 +114,7 @@ main(List<String> args) {
115114
if (printedAnything) {
116115
for (String part in combinedChange.keys) {
117116
print("Combined least change for $part: "
118-
"${combinedChange[part].toStringAsFixed(2)} ms.");
117+
"${combinedChange[part]!.toStringAsFixed(2)} ms.");
119118
}
120119
} else {
121120
print("Nothing significant found.");

pkg/front_end/tool/update_all.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// @dart=2.9
6-
75
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart' as id;
86
import 'update_expectations.dart' as expectations;
97

pkg/front_end/tool/update_expectations.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// @dart=2.9
6-
75
import 'fasta.dart' as fasta;
86

97
const List<String> standardSuites = <String>[
@@ -19,7 +17,7 @@ const List<String> specialSuites = <String>[
1917
'incremental',
2018
];
2119

22-
Future<void> runStandardSuites([List<String> args]) async {
20+
Future<void> runStandardSuites([List<String>? args]) async {
2321
// Assert that 'strong' is the first suite - we use the assumption below.
2422
assert(standardSuites.first == 'weak', "Suite 'weak' most be the first.");
2523
bool first = true;

0 commit comments

Comments
 (0)