Index: pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart |
diff --git a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart |
index e9dadd785fde5098cf96b6d54c24038d4daca17e..dabc038ae6e826462398cef27a812fd597e71b8f 100644 |
--- a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart |
+++ b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart |
@@ -321,6 +321,10 @@ class ThisAccessor extends FastaAccessor { |
buildPropertyAccess( |
IncompleteSend send, int operatorOffset, bool isNullAware) { |
if (isInitializer && send is SendAccessor) { |
+ if (isNullAware) { |
+ helper.addCompileTimeError( |
+ operatorOffset, "Expected '.'\nTry removing '?'."); |
+ } |
return buildConstructorInitializer( |
offsetForToken(send.token), send.name, send.arguments); |
} |
@@ -473,6 +477,12 @@ class SendAccessor extends IncompleteSend { |
} |
if (receiver is PrefixBuilder) { |
PrefixBuilder prefix = receiver; |
+ if (isNullAware) { |
+ helper.addCompileTimeError( |
+ offsetForToken(token), |
+ "Library prefix '${prefix.name}' can't be used with null-aware " |
+ "operator.\nTry removing '?'."); |
+ } |
receiver = helper.scopeLookup(prefix.exports, name.name, token, |
isQualified: true, prefix: prefix); |
return helper.finishSend(receiver, arguments, offsetForToken(token)); |
@@ -530,6 +540,12 @@ class IncompletePropertyAccessor extends IncompleteSend { |
} |
if (receiver is PrefixBuilder) { |
PrefixBuilder prefix = receiver; |
+ if (isNullAware) { |
+ helper.addCompileTimeError( |
+ offsetForToken(token), |
+ "Library prefix '${prefix.name}' can't be used with null-aware " |
+ "operator.\nTry removing '?'."); |
+ } |
return helper.scopeLookup(prefix.exports, name.name, token, |
isQualified: true, prefix: prefix); |
} |