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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart

Issue 2780483002: Complain about assignments to parenthesized expressions. (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
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 90151e15b3b193c45ea305d7d0cfb90d80750fec..98a30e47396b1bb3ac7aad6c3dc6a47b9d227acb 100644
--- a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
@@ -20,6 +20,7 @@ import 'package:kernel/frontend/accessors.dart' as kernel
IndexAccessor,
NullAwarePropertyAccessor,
PropertyAccessor,
+ ReadOnlyAccessor,
StaticAccessor,
SuperIndexAccessor,
SuperPropertyAccessor,
@@ -775,6 +776,32 @@ class VariableAccessor extends kernel.VariableAccessor with FastaAccessor {
toString() => "VariableAccessor()";
}
+class ReadOnlyAccessor extends kernel.ReadOnlyAccessor with FastaAccessor {
+ final BuilderHelper helper;
+
+ final String plainNameForRead;
+
+ ReadOnlyAccessor(
+ this.helper, Expression expression, this.plainNameForRead, int offset)
+ : super(expression, offset);
+
+ Expression doInvocation(int offset, Arguments arguments) {
+ return buildMethodInvocation(
+ buildSimpleRead(), callName, arguments, offset);
+ }
+}
+
+class ParenthesizedExpression extends ReadOnlyAccessor {
+ ParenthesizedExpression(
+ BuilderHelper helper, Expression expression, int offset)
+ : super(helper, expression, "<a parenthesized expression>", offset);
+
+ Expression makeInvalidWrite(Expression value) {
+ return helper.buildCompileTimeError(
+ "Can't assign to a parenthesized expression.", offset);
+ }
+}
+
bool isFieldOrGetter(Member member) {
return member is Field || (member is Procedure && member.isGetter);
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/body_builder.dart ('k') | pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698