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

Commit 0977118

Browse files
clean up
1 parent ac499c7 commit 0977118

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

tools/const_finder/bin/main.dart

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,16 @@ void main(List<String> args) {
4242
..addOption('kernel-file',
4343
valueHelp: 'path/to/main.dill',
4444
help: 'The path to a kernel file to parse, which was created from the '
45-
'main-package-uri library.')
45+
'main-package-uri library.',
46+
mandatory: true)
4647
..addOption('class-library-uri',
48+
mandatory: true,
4749
help: 'The package: URI of the class to find.',
4850
valueHelp: 'package:flutter/src/widgets/icon_data.dart')
4951
..addOption('class-name',
50-
help: 'The class name for the class to find.', valueHelp: 'IconData')
52+
help: 'The class name for the class to find.',
53+
valueHelp: 'IconData',
54+
mandatory: true)
5155
..addSeparator('Optional arguments:')
5256
..addFlag('pretty',
5357
negatable: false,
@@ -58,14 +62,7 @@ void main(List<String> args) {
5862
help: 'Print usage and exit');
5963

6064
final ArgResults argResults = parser.parse(args);
61-
T getArg<T>(String name) {
62-
try {
63-
return argResults[name] as T;
64-
} catch (err) {
65-
stderr.writeln('Parsing error trying to parse the argument "$name"');
66-
rethrow;
67-
}
68-
}
65+
T getArg<T>(String name) => argResults[name] as T;
6966

7067
if (getArg<bool>('help')) {
7168
stdout.writeln(parser.usage);

tools/const_finder/lib/const_finder.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,7 @@ class _ConstVisitor extends RecursiveVisitor<void> {
9696
}
9797

9898
final DartType type = expression.type;
99-
if (type is InterfaceType && type.classNode.name == 'StaticIconProvider') {
100-
return true;
101-
}
102-
return false;
99+
return type is InterfaceType && type.classNode.name == 'StaticIconProvider';
103100
});
104101
}
105102

0 commit comments

Comments
 (0)