This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +65
-2
lines changed
lib/src/services/correction/dart
test/src/services/correction/assist Expand file tree Collapse file tree 5 files changed +65
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ class ConvertToExpressionFunctionBody extends CorrectionProducer {
28
28
if (body is ! BlockFunctionBody || body.isGenerator) {
29
29
return ;
30
30
}
31
+ var parent = body.parent;
32
+ if (parent is ConstructorDeclaration && parent.factoryKeyword == null ) {
33
+ return ;
34
+ }
31
35
// prepare return statement
32
36
List <Statement > statements = body.block.statements;
33
37
if (statements.length != 1 ) {
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ main() {
90
90
''' );
91
91
}
92
92
93
- Future <void > test_constructor () async {
93
+ Future <void > test_constructor_factory () async {
94
94
await resolveTestCode ('''
95
95
class A {
96
96
A.named();
@@ -109,6 +109,19 @@ class A {
109
109
''' );
110
110
}
111
111
112
+ Future <void > test_constructor_generative () async {
113
+ await resolveTestCode ('''
114
+ class A {
115
+ int x;
116
+
117
+ A() {
118
+ x = 3;
119
+ }
120
+ }
121
+ ''' );
122
+ await assertNoAssistAt ('A()' );
123
+ }
124
+
112
125
Future <void > test_function_onBlock () async {
113
126
await resolveTestCode ('''
114
127
fff() {
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
2
+ // for details. All rights reserved. Use of this source code is governed by a
3
+ // BSD-style license that can be found in the LICENSE file.
4
+
5
+ class _InspectorOverlayLayer {
6
+ String selection;
7
+
8
+ _InspectorOverlayLayer (this .selection) {
9
+ bool inDebugMode = false ;
10
+ assert (() {
11
+ inDebugMode = true ;
12
+ return true ;
13
+ }());
14
+ if (inDebugMode == false ) {
15
+ throw Error ();
16
+ }
17
+ }
18
+ }
19
+
20
+ main () {
21
+ _InspectorOverlayLayer ('hello' );
22
+ _InspectorOverlayLayer ('hello' );
23
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
2
+ // for details. All rights reserved. Use of this source code is governed by a
3
+ // BSD-style license that can be found in the LICENSE file.
4
+
5
+ class _InspectorOverlayLayer {
6
+ String selection;
7
+
8
+ _InspectorOverlayLayer (this .selection) {
9
+ bool inDebugMode = false ;
10
+ assert (() {
11
+ inDebugMode = true ;
12
+ return true ;
13
+ }());
14
+ if (inDebugMode == false ) {
15
+ throw Error ();
16
+ }
17
+ }
18
+ }
19
+
20
+ main () {
21
+ _InspectorOverlayLayer ('hello' );
22
+ _InspectorOverlayLayer ('hello' );
23
+ }
Original file line number Diff line number Diff line change @@ -27,5 +27,5 @@ CHANNEL dev
27
27
MAJOR 2
28
28
MINOR 14
29
29
PATCH 0
30
- PRERELEASE 91
30
+ PRERELEASE 92
31
31
PRERELEASE_PATCH 0
You can’t perform that action at this time.
0 commit comments