Skip to content

Commit 9f916fb

Browse files
committed
cleanup(GeneratedOutput): assert ctor values, tweak ctor params, etc
- paranoid check that output is never null or empty - stackTrace is always provided, so make it a normal param - No need to check error for null in helper, never null in this path
1 parent 1ff672b commit 9f916fb

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

source_gen/lib/src/generated_output.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@ class GeneratedOutput {
1616

1717
GeneratedOutput(this.generator, this.output)
1818
: error = null,
19-
stackTrace = null;
19+
stackTrace = null,
20+
assert(output != null && output.isNotEmpty);
2021

21-
GeneratedOutput.fromError(this.generator, this.error, [this.stackTrace])
22+
GeneratedOutput.fromError(this.generator, this.error, this.stackTrace)
2223
: this.output = _outputFromError(error);
2324
}
2425

2526
String _outputFromError(Object error) {
26-
if (error == null) {
27-
throw new ArgumentError.notNull('error');
28-
}
29-
3027
var buffer = new StringBuffer();
3128

3229
_commentWithHeader(_errorHeader, error.toString(), buffer);

0 commit comments

Comments
 (0)