@@ -220,11 +220,11 @@ Future<void> run(List<String> arguments) async {
220220FeatureSet _parsingFeatureSet () => FeatureSet .latestLanguageVersion ();
221221
222222_Line _getLine (ParseStringResult parseResult, int offset) {
223- final int lineNumber =
224- parseResult.lineInfo.getLocation (offset).lineNumber;
223+ final int lineNumber = parseResult.lineInfo.getLocation (offset).lineNumber;
225224 final String content = parseResult.content.substring (
226- parseResult.lineInfo.getOffsetOfLine (lineNumber - 1 ),
227- parseResult.lineInfo.getOffsetOfLine (lineNumber) - 1 );
225+ parseResult.lineInfo.getOffsetOfLine (lineNumber - 1 ),
226+ parseResult.lineInfo.getOffsetOfLine (lineNumber) - 1 ,
227+ );
228228 return _Line (lineNumber, content);
229229}
230230
@@ -264,27 +264,21 @@ Future<void> verifyNoDoubleClamp(String workingDirectory) async {
264264 _allFiles (flutterLibPath, 'dart' , minimumMatches: 100 );
265265 final List <String > errors = < String > [];
266266 await for (final File file in testFiles) {
267- try {
268- final ParseStringResult parseResult = parseFile (
269- featureSet: _parsingFeatureSet (),
270- path: file.absolute.path,
271- );
272- final _DoubleClampVisitor visitor = _DoubleClampVisitor (parseResult);
273- visitor.visitCompilationUnit (parseResult.unit);
274- for (final _Line clamp in visitor.clamps) {
275- errors.add ('${file .path }:${clamp .line }: `clamp` method used without ignore_clamp_double_lint comment.' );
276- }
277- } catch (ex) {
278- // TODO(gaaclarke): There is a bug with super parameter parsing on mac so
279- // we skip certain files until that is fixed.
280- // https://github.com/dart-lang/sdk/issues/49032
281- print ('skipping ${file .path }: $ex ' );
267+ final ParseStringResult parseResult = parseFile (
268+ featureSet: _parsingFeatureSet (),
269+ path: file.absolute.path,
270+ );
271+ final _DoubleClampVisitor visitor = _DoubleClampVisitor (parseResult);
272+ visitor.visitCompilationUnit (parseResult.unit);
273+ for (final _Line clamp in visitor.clamps) {
274+ errors.add ('${file .path }:${clamp .line }: `clamp` method used instead of `clampDouble`.' );
282275 }
283276 }
284277 if (errors.isNotEmpty) {
285278 foundError (< String > [
286279 ...errors,
287- '\n ${bold }See: https://github.com/flutter/flutter/pull/103559' ,
280+ '\n ${bold }For performance reasons, we use a custom `clampDouble` function instead of using `Double.clamp`.$reset ' ,
281+ '\n ${bold }For non-double uses of `clamp`, use `// ignore_clamp_double_lint` on the line to silence this message.$reset ' ,
288282 ]);
289283 }
290284}
0 commit comments