Stop inlining methods in a combinator
Fixes https://github.com/dart-lang/sdk/issues/28253 Change-Id: I186f36c107b11dcfdefb2aa56420b607e80aa69e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434021 Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
committed by
Commit Queue
parent
7019f1c3d1
commit
b67482d6bc
@@ -416,7 +416,8 @@ class InlineMethodRefactoringImpl extends RefactoringImpl
|
||||
} else if (selectedNode is MethodDeclaration) {
|
||||
element = selectedNode.declaredFragment?.element;
|
||||
isDeclaration = true;
|
||||
} else if (selectedNode is SimpleIdentifier) {
|
||||
} else if (selectedNode is SimpleIdentifier &&
|
||||
selectedNode.parent is! Combinator) {
|
||||
element = selectedNode.writeOrReadElement2;
|
||||
} else {
|
||||
return fatalStatus;
|
||||
|
||||
@@ -243,6 +243,24 @@ void f() {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> test_bad_inShowCombinator() async {
|
||||
newFile('$testPackageLibPath/a.dart', '''
|
||||
void f() {
|
||||
print(42);
|
||||
}
|
||||
''');
|
||||
await indexTestUnit(r'''
|
||||
import 'a.dart' show f;
|
||||
|
||||
void g() {
|
||||
f();
|
||||
}
|
||||
''');
|
||||
_createRefactoring('f;');
|
||||
// error
|
||||
return _assertInvalidSelection();
|
||||
}
|
||||
|
||||
Future<void> test_bad_notExecutableElement() async {
|
||||
await indexTestUnit(r'''
|
||||
void f() {
|
||||
|
||||
Reference in New Issue
Block a user