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

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

Issue 2927013004: Rework type inference of assignments to index expressions. (Closed)
Patch Set: 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 | « no previous file | pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart » ('j') | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library fasta.fasta_accessors; 5 library fasta.fasta_accessors;
6 6
7 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart' 7 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart'
8 show KernelArguments, KernelThisExpression; 8 show KernelArguments, KernelComplexAssignment, KernelThisExpression;
9 9
10 import 'package:front_end/src/fasta/kernel/utils.dart' show offsetForToken; 10 import 'package:front_end/src/fasta/kernel/utils.dart' show offsetForToken;
11 11
12 import 'package:front_end/src/scanner/token.dart' show Token; 12 import 'package:front_end/src/scanner/token.dart' show Token;
13 13
14 import 'frontend_accessors.dart' show Accessor; 14 import 'frontend_accessors.dart' show Accessor;
15 15
16 import 'package:front_end/src/fasta/type_inference/type_promotion.dart' 16 import 'package:front_end/src/fasta/type_inference/type_promotion.dart'
17 show TypePromoter; 17 show TypePromoter;
18 18
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 int offset}) { 183 int offset}) {
184 return helper.throwNoSuchMethodError(receiver, name ?? plainNameForWrite, 184 return helper.throwNoSuchMethodError(receiver, name ?? plainNameForWrite,
185 arguments, offset ?? offsetForToken(this.token), 185 arguments, offset ?? offsetForToken(this.token),
186 isGetter: isGetter, 186 isGetter: isGetter,
187 isSetter: isSetter, 187 isSetter: isSetter,
188 isSuper: isSuper, 188 isSuper: isSuper,
189 isStatic: isStatic); 189 isStatic: isStatic);
190 } 190 }
191 191
192 bool get isThisPropertyAccessor => false; 192 bool get isThisPropertyAccessor => false;
193
194 @override
195 KernelComplexAssignment startComplexAssignment(Expression rhs) => null;
193 } 196 }
194 197
195 abstract class ErrorAccessor implements FastaAccessor { 198 abstract class ErrorAccessor implements FastaAccessor {
196 /// Pass [arguments] that must be evaluated before throwing an error. At 199 /// Pass [arguments] that must be evaluated before throwing an error. At
197 /// most one of [isGetter] and [isSetter] should be true and they're passed 200 /// most one of [isGetter] and [isSetter] should be true and they're passed
198 /// to [BuilderHelper.buildThrowNoSuchMethodError] if it is used. 201 /// to [BuilderHelper.buildThrowNoSuchMethodError] if it is used.
199 Expression buildError(Arguments arguments, 202 Expression buildError(Arguments arguments,
200 {bool isGetter: false, bool isSetter: false, int offset}); 203 {bool isGetter: false, bool isSetter: false, int offset});
201 204
202 Name get name => internalError("Unsupported operation."); 205 Name get name => internalError("Unsupported operation.");
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 Expression index, 597 Expression index,
595 Procedure getter, 598 Procedure getter,
596 Procedure setter) { 599 Procedure setter) {
597 if (receiver is ThisExpression) { 600 if (receiver is ThisExpression) {
598 return new ThisIndexAccessor(helper, token, index, getter, setter); 601 return new ThisIndexAccessor(helper, token, index, getter, setter);
599 } else { 602 } else {
600 return new IndexAccessor.internal( 603 return new IndexAccessor.internal(
601 helper, token, receiver, index, getter, setter); 604 helper, token, receiver, index, getter, setter);
602 } 605 }
603 } 606 }
607
608 @override
609 KernelComplexAssignment startComplexAssignment(Expression rhs) =>
610 new KernelComplexAssignment()
611 ..receiver = receiver
612 ..index = index
613 ..rhs = rhs;
604 } 614 }
605 615
606 class PropertyAccessor extends kernel.PropertyAccessor with FastaAccessor { 616 class PropertyAccessor extends kernel.PropertyAccessor with FastaAccessor {
607 final BuilderHelper helper; 617 final BuilderHelper helper;
608 618
609 PropertyAccessor.internal(this.helper, Token token, Expression receiver, 619 PropertyAccessor.internal(this.helper, Token token, Expression receiver,
610 Name name, Member getter, Member setter) 620 Name name, Member getter, Member setter)
611 : super.internal(helper, receiver, name, getter, setter, token); 621 : super.internal(helper, receiver, name, getter, setter, token);
612 622
613 String get plainNameForRead => name.name; 623 String get plainNameForRead => name.name;
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 offset ??= offsetForToken(this.token); 981 offset ??= offsetForToken(this.token);
972 return helper.throwNoSuchMethodError(new NullLiteral()..fileOffset = offset, 982 return helper.throwNoSuchMethodError(new NullLiteral()..fileOffset = offset,
973 plainNameForRead, arguments, offset, 983 plainNameForRead, arguments, offset,
974 isGetter: isGetter, isSetter: isSetter); 984 isGetter: isGetter, isSetter: isSetter);
975 } 985 }
976 } 986 }
977 987
978 bool isFieldOrGetter(Member member) { 988 bool isFieldOrGetter(Member member) {
979 return member is Field || (member is Procedure && member.isGetter); 989 return member is Field || (member is Procedure && member.isGetter);
980 } 990 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698