Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: pkg/analysis_server/test/services/correction/fix_test.dart

Issue 2946093002: Fix invalid initializing formal by adding a field (Closed)
Patch Set: cleanup Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix_internal.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; 7 import 'package:analysis_server/plugin/edit/fix/fix_core.dart';
8 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; 8 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart';
9 import 'package:analysis_server/src/services/correction/fix.dart'; 9 import 'package:analysis_server/src/services/correction/fix.dart';
10 import 'package:analysis_server/src/services/correction/fix_internal.dart'; 10 import 'package:analysis_server/src/services/correction/fix_internal.dart';
(...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 import 'libB.dart'; 1950 import 'libB.dart';
1951 class C { 1951 class C {
1952 A test; 1952 A test;
1953 } 1953 }
1954 main(C c) { 1954 main(C c) {
1955 c.test = getA(); 1955 c.test = getA();
1956 } 1956 }
1957 '''); 1957 ''');
1958 } 1958 }
1959 1959
1960 test_createField_invalidInitializer_withoutType() async {
1961 await resolveTestUnit('''
1962 class C {
1963 C(this.text);
1964 }
1965 ''');
1966 await assertHasFix(
1967 DartFixKind.CREATE_FIELD,
1968 '''
1969 class C {
1970 var text;
1971
1972 C(this.text);
1973 }
1974 ''');
1975 }
1976
1977 test_createField_invalidInitializer_withType() async {
1978 await resolveTestUnit('''
1979 class C {
1980 C(String this.text);
1981 }
1982 ''');
1983 await assertHasFix(
1984 DartFixKind.CREATE_FIELD,
1985 '''
1986 class C {
1987 String text;
1988
1989 C(String this.text);
1990 }
1991 ''');
1992 }
1993
1960 test_createField_setter_generic_BAD() async { 1994 test_createField_setter_generic_BAD() async {
1961 await resolveTestUnit(''' 1995 await resolveTestUnit('''
1962 class A { 1996 class A {
1963 } 1997 }
1964 class B<T> { 1998 class B<T> {
1965 List<T> items; 1999 List<T> items;
1966 main(A a) { 2000 main(A a) {
1967 a.test = items; 2001 a.test = items;
1968 } 2002 }
1969 } 2003 }
(...skipping 4897 matching lines...) Expand 10 before | Expand all | Expand 10 after
6867 @override 6901 @override
6868 final AnalysisError error; 6902 final AnalysisError error;
6869 6903
6870 _DartFixContextImpl(this.resourceProvider, this.analysisDriver, 6904 _DartFixContextImpl(this.resourceProvider, this.analysisDriver,
6871 this.astProvider, this.unit, this.error); 6905 this.astProvider, this.unit, this.error);
6872 6906
6873 @override 6907 @override
6874 GetTopLevelDeclarations get getTopLevelDeclarations => 6908 GetTopLevelDeclarations get getTopLevelDeclarations =>
6875 analysisDriver.getTopLevelNameDeclarations; 6909 analysisDriver.getTopLevelNameDeclarations;
6876 } 6910 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698