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

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

Issue 2963763002: Change how unresolved super sends are handled. (Closed)
Patch Set: Rebased on 6cb702b723184ef8875871e4c15004d1ea0a8460. Created 3 years, 5 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
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 8 show
9 KernelArguments, 9 KernelArguments,
10 KernelComplexAssignment, 10 KernelComplexAssignment,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 [int charOffset = -1]); 95 [int charOffset = -1]);
96 96
97 Expression buildStaticInvocation(Procedure target, Arguments arguments); 97 Expression buildStaticInvocation(Procedure target, Arguments arguments);
98 98
99 Expression buildProblemExpression(ProblemBuilder builder, int offset); 99 Expression buildProblemExpression(ProblemBuilder builder, int offset);
100 100
101 Expression throwNoSuchMethodError( 101 Expression throwNoSuchMethodError(
102 Expression receiver, String name, Arguments arguments, int offset, 102 Expression receiver, String name, Arguments arguments, int offset,
103 {bool isSuper, bool isGetter, bool isSetter, bool isStatic}); 103 {bool isSuper, bool isGetter, bool isSetter, bool isStatic});
104 104
105 Expression invokeSuperNoSuchMethod(
106 String name, Arguments arguments, int charOffset,
107 {bool isGetter, bool isSetter});
108
109 bool checkArguments(FunctionNode function, Arguments arguments, 105 bool checkArguments(FunctionNode function, Arguments arguments,
110 List<TypeParameter> typeParameters); 106 List<TypeParameter> typeParameters);
111 107
112 StaticGet makeStaticGet(Member readTarget, Token token); 108 StaticGet makeStaticGet(Member readTarget, Token token);
113 109
114 dynamic addCompileTimeError(int charOffset, String message, {bool silent}); 110 dynamic addCompileTimeError(int charOffset, String message, {bool silent});
115 111
116 bool isIdentical(Member member); 112 bool isIdentical(Member member);
117 113
118 Expression buildMethodInvocation( 114 Expression buildMethodInvocation(
119 Expression receiver, Name name, Arguments arguments, int offset, 115 Expression receiver, Name name, Arguments arguments, int offset,
120 {bool isConstantExpression, bool isNullAware, bool isImplicitCall}); 116 {bool isConstantExpression, bool isNullAware, bool isImplicitCall});
121 117
122 DartType validatedTypeVariableUse( 118 DartType validatedTypeVariableUse(
123 TypeParameterType type, int offset, bool nonInstanceAccessIsError); 119 TypeParameterType type, int offset, bool nonInstanceAccessIsError);
124 120
125 void warning(String message, [int charOffset]); 121 void warning(String message, [int charOffset]);
122
123 void warnUnresolvedSuperGet(Name name, int charOffset);
124
125 void warnUnresolvedSuperSet(Name name, int charOffset);
126
127 void warnUnresolvedSuperMethod(Name name, int charOffset);
126 } 128 }
127 129
128 abstract class FastaAccessor implements Accessor { 130 abstract class FastaAccessor implements Accessor {
129 BuilderHelper get helper; 131 BuilderHelper get helper;
130 132
131 String get plainNameForRead; 133 String get plainNameForRead;
132 134
133 Uri get uri => helper.uri; 135 Uri get uri => helper.uri;
134 136
135 String get plainNameForWrite => plainNameForRead; 137 String get plainNameForWrite => plainNameForRead;
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 helper.addCompileTimeError(offset, "Not a constant expression."); 756 helper.addCompileTimeError(offset, "Not a constant expression.");
755 } 757 }
756 if (getter == null || isFieldOrGetter(getter)) { 758 if (getter == null || isFieldOrGetter(getter)) {
757 return helper.buildMethodInvocation( 759 return helper.buildMethodInvocation(
758 buildSimpleRead(), callName, arguments, offset, 760 buildSimpleRead(), callName, arguments, offset,
759 // This isn't a constant expression, but we have checked if a 761 // This isn't a constant expression, but we have checked if a
760 // constant expression error should be emitted already. 762 // constant expression error should be emitted already.
761 isConstantExpression: true, 763 isConstantExpression: true,
762 isImplicitCall: true); 764 isImplicitCall: true);
763 } else { 765 } else {
764 return new DirectMethodInvocation( 766 // TODO(ahe): This could be something like "super.property(...)" where
765 new KernelThisExpression(), getter, arguments) 767 // property is a setter.
766 ..fileOffset = offset; 768 return internalError("Unhandled invocation ${getter.runtimeType}.",
769 helper.uri, offsetForToken(token));
767 } 770 }
768 } 771 }
769 772
770 Expression makeInvalidRead() {
771 int offset = offsetForToken(token);
772 return helper.invokeSuperNoSuchMethod(
773 plainNameForRead, new Arguments.empty()..fileOffset = offset, offset,
774 isGetter: true);
775 }
776
777 Expression makeInvalidWrite(Expression value) {
778 return helper.invokeSuperNoSuchMethod(
779 plainNameForRead,
780 new Arguments(<Expression>[value])..fileOffset = value.fileOffset,
781 offsetForToken(token),
782 isSetter: true);
783 }
784
785 toString() => "SuperPropertyAccessor()"; 773 toString() => "SuperPropertyAccessor()";
786 774
787 @override 775 @override
788 KernelComplexAssignment startComplexAssignment(Expression rhs) => 776 KernelComplexAssignment startComplexAssignment(Expression rhs) =>
789 new KernelPropertyAssign(null, rhs, isSuper: true); 777 new KernelPropertyAssign(null, rhs, isSuper: true);
790 } 778 }
791 779
792 class ThisIndexAccessor extends kernel.ThisIndexAccessor with FastaAccessor { 780 class ThisIndexAccessor extends kernel.ThisIndexAccessor with FastaAccessor {
793 ThisIndexAccessor(BuilderHelper helper, Token token, Expression index, 781 ThisIndexAccessor(BuilderHelper helper, Token token, Expression index,
794 Procedure getter, Procedure setter) 782 Procedure getter, Procedure setter)
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 offset ??= offsetForToken(this.token); 1035 offset ??= offsetForToken(this.token);
1048 return helper.throwNoSuchMethodError(new NullLiteral()..fileOffset = offset, 1036 return helper.throwNoSuchMethodError(new NullLiteral()..fileOffset = offset,
1049 plainNameForRead, arguments, offset, 1037 plainNameForRead, arguments, offset,
1050 isGetter: isGetter, isSetter: isSetter); 1038 isGetter: isGetter, isSetter: isSetter);
1051 } 1039 }
1052 } 1040 }
1053 1041
1054 bool isFieldOrGetter(Member member) { 1042 bool isFieldOrGetter(Member member) {
1055 return member is Field || (member is Procedure && member.isGetter); 1043 return member is Field || (member is Procedure && member.isGetter);
1056 } 1044 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/body_builder.dart ('k') | 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