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

Side by Side Diff: pkg/front_end/lib/src/fasta/builder/class_builder.dart

Issue 2765943002: Improve handling of complicated getters and setters. (Closed)
Patch Set: Update status files. 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/body_builder.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.class_builder; 5 library fasta.class_builder;
6 6
7 import '../errors.dart' show internalError; 7 import '../errors.dart' show internalError;
8 8
9 import 'builder.dart' 9 import 'builder.dart'
10 show 10 show
11 Builder, 11 Builder,
12 ConstructorReferenceBuilder, 12 ConstructorReferenceBuilder,
13 LibraryBuilder, 13 LibraryBuilder,
14 MetadataBuilder, 14 MetadataBuilder,
15 MixinApplicationBuilder, 15 MixinApplicationBuilder,
16 NamedTypeBuilder, 16 NamedTypeBuilder,
17 TypeBuilder, 17 TypeBuilder,
18 TypeDeclarationBuilder, 18 TypeDeclarationBuilder,
19 TypeVariableBuilder; 19 TypeVariableBuilder;
20 20
21 import 'scope.dart' show AmbiguousBuilder, Scope; 21 import 'scope.dart' show AccessErrorBuilder, AmbiguousBuilder, Scope;
22 22
23 abstract class ClassBuilder<T extends TypeBuilder, R> 23 abstract class ClassBuilder<T extends TypeBuilder, R>
24 extends TypeDeclarationBuilder<T, R> { 24 extends TypeDeclarationBuilder<T, R> {
25 final List<TypeVariableBuilder> typeVariables; 25 final List<TypeVariableBuilder> typeVariables;
26 26
27 T supertype; 27 T supertype;
28 28
29 List<T> interfaces; 29 List<T> interfaces;
30 30
31 final Map<String, Builder> members; 31 final Map<String, Builder> members;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 while (current != null) { 90 while (current != null) {
91 if (current.isGetter && getterBuilder == null) { 91 if (current.isGetter && getterBuilder == null) {
92 getterBuilder = current; 92 getterBuilder = current;
93 } else if (current.isSetter && setterBuilder == null) { 93 } else if (current.isSetter && setterBuilder == null) {
94 setterBuilder = current; 94 setterBuilder = current;
95 } else { 95 } else {
96 return new AmbiguousBuilder(name, builder, charOffset, fileUri); 96 return new AmbiguousBuilder(name, builder, charOffset, fileUri);
97 } 97 }
98 current = current.next; 98 current = current.next;
99 } 99 }
100 if (getterBuilder?.isInstanceMember ?? false) {
101 getterBuilder = null;
102 }
103 if (setterBuilder?.isInstanceMember ?? false) {
104 setterBuilder = null;
105 }
100 builder = isSetter ? setterBuilder : getterBuilder; 106 builder = isSetter ? setterBuilder : getterBuilder;
107 if (builder == null) {
108 if (isSetter && getterBuilder != null) {
109 return new AccessErrorBuilder(
110 name, getterBuilder, charOffset, fileUri);
111 } else if (!isSetter && setterBuilder != null) {
112 return new AccessErrorBuilder(
113 name, setterBuilder, charOffset, fileUri);
114 }
115 }
101 } 116 }
102 if (builder == null) { 117 if (builder == null) {
103 return null; 118 return null;
104 } else if (isSetter && builder.isGetter) { 119 } else if (isSetter && builder.isGetter) {
105 return null; 120 return null;
106 } else { 121 } else {
107 return builder.isInstanceMember ? null : builder; 122 return builder.isInstanceMember ? null : builder;
108 } 123 }
109 } 124 }
110 125
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 argument = argument.subst(substitutionMap); 181 argument = argument.subst(substitutionMap);
167 } 182 }
168 directSubstitutionMap[variables[i]] = argument; 183 directSubstitutionMap[variables[i]] = argument;
169 } 184 }
170 substitutionMap = directSubstitutionMap; 185 substitutionMap = directSubstitutionMap;
171 } 186 }
172 } 187 }
173 return substitutionMap; 188 return substitutionMap;
174 } 189 }
175 } 190 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/body_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698