mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:12:08 +00:00
Fix for NPE when prefix completion after an expression without type.
R=brianwilkerson@google.com Change-Id: I3ef1c1e1f981e3a5c9ed6da066a1d204c6b3816d Reviewed-on: https://dart-review.googlesource.com/71620 Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
d332cae86e
commit
83324a8db9
|
@ -563,6 +563,7 @@ class PostfixCompletionProcessor {
|
|||
}
|
||||
Expression expr = list.firstWhere((expr) {
|
||||
DartType type = expr.staticType;
|
||||
if (type == null) return false;
|
||||
if (type.isSubtypeOf(builtInType)) return true;
|
||||
Element element = type.element;
|
||||
if (element is TypeDefiningElement) {
|
||||
|
|
|
@ -332,6 +332,15 @@ f(List expr) {
|
|||
''');
|
||||
}
|
||||
|
||||
test_if_invalid_importPrefix() async {
|
||||
await _assertNotApplicable('.if', '''
|
||||
import 'dart:async' as p;
|
||||
f() {
|
||||
p.if
|
||||
}
|
||||
''');
|
||||
}
|
||||
|
||||
test_ifDynamic() async {
|
||||
await _prepareCompletion('.if', '''
|
||||
f(expr) {
|
||||
|
|
Loading…
Reference in a new issue