Skip to content

Commit 6c6cba8

Browse files
srawlinsCommit Queue
authored andcommitted
DAS: Tidy the replay script
Previously, the Driver class here was instantiated with no parameters, as an empty object, and then in the `_processCommandLine` method (called once by `run`), we set all the fields. These fields in practice are immutable and do not represent any "state" of running the Driver. This is not taking advantage of any OO practices or our best practices of using final fields. This CL moves the argument-parsing logic to a static method, `Driver.fromArgs`. This can't be a factory constructor because some args do result in no Driver being returned (`--help`, not enough args, and an exception being thrown). Then the values of the flags can be final fields, set in the private constructor. Then, `run()` does not set fields or read arguments; it just runs :D Additionally, the fields can be made private. Additionally, the command-line argument name constants should be lowerCamelCase. Additionally, `_createArgParser` does not need to be an instance method; it makes more sense as a static getter. Change-Id: If3b0363859f35b87dfdbcedf43b472bf5689b200 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/454402 Reviewed-by: Keerti Parthasarathy <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent 7ef361b commit 6c6cba8

File tree

1 file changed

+148
-135
lines changed

1 file changed

+148
-135
lines changed

0 commit comments

Comments
 (0)