This repository was archived by the owner on Apr 8, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +39
-3
lines changed
Expand file tree Collapse file tree 4 files changed +39
-3
lines changed Original file line number Diff line number Diff line change 1- ## 2.2.0-dev
1+ ## 2.2.0
22
33* Imports are prefixed with ` _i1 ` rather than ` _1 ` which satisfies the lint
44 ` lowercase_with_underscores ` . While not a strictly breaking change you may
@@ -31,6 +31,27 @@ void main() {
3131
3232* ` literalList ` accepts an ` Iterable ` argument.
3333
34+ * Fixed an NPE when a method had a return type of a ` FunctionType ` :
35+
36+ ``` dart
37+ void main() {
38+ test('should create a method with a function type return type', () {
39+ expect(
40+ new Method((b) => b
41+ ..name = 'foo'
42+ ..returns = new FunctionType((b) => b
43+ ..returnType = refer('String')
44+ ..requiredParameters.addAll([
45+ refer('int'),
46+ ]))),
47+ equalsDart(r'''
48+ String Function(int) foo();
49+ '''),
50+ );
51+ });
52+ }
53+ ```
54+
3455## 2.1.0
3556
3657We now require the Dart 2.0-dev branch SDK (` >= 2.0.0-dev ` ).
Original file line number Diff line number Diff line change @@ -344,7 +344,7 @@ class DartEmitter extends Object
344344 output.write ('static ' );
345345 }
346346 if (spec.returns != null ) {
347- spec.returns.type. accept (this , output);
347+ spec.returns.accept (this , output);
348348 output.write (' ' );
349349 }
350350 if (spec.type == MethodType .getter) {
Original file line number Diff line number Diff line change 11name : code_builder
2- version : 2.2.0-dev
2+ version : 2.2.0
33description : A fluent API for generating Dart code
44author :
Dart Team <[email protected] > 55homepage : https://github.com/dart-lang/code_builder
Original file line number Diff line number Diff line change @@ -99,6 +99,21 @@ void main() {
9999 );
100100 });
101101
102+ test ('should create a method with a function type return type' , () {
103+ expect (
104+ new Method ((b) => b
105+ ..name = 'foo'
106+ ..returns = new FunctionType ((b) => b
107+ ..returnType = refer ('String' )
108+ ..requiredParameters.addAll ([
109+ refer ('int' ),
110+ ]))),
111+ equalsDart (r'''
112+ String Function(int) foo();
113+ ''' ),
114+ );
115+ });
116+
102117 test ('should create a method with generic types' , () {
103118 expect (
104119 new Method ((b) => b
You can’t perform that action at this time.
0 commit comments