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

Side by Side Diff: pkg/front_end/lib/src/fasta/source/source_class_builder.dart

Issue 2689303003: Implement type variables in mixin applications. (Closed)
Patch Set: Restore duplication handling and set mixedInType. Created 3 years, 10 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.source_class_builder; 5 library fasta.source_class_builder;
6 6
7 import 'package:kernel/ast.dart' show 7 import 'package:kernel/ast.dart' show
8 Class, 8 Class,
9 Constructor, 9 Constructor,
10 Supertype, 10 Supertype,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 class SourceClassBuilder extends KernelClassBuilder { 47 class SourceClassBuilder extends KernelClassBuilder {
48 final Class cls; 48 final Class cls;
49 49
50 final Map<String, Builder> constructors; 50 final Map<String, Builder> constructors;
51 51
52 final Map<String, Builder> membersInScope; 52 final Map<String, Builder> membersInScope;
53 53
54 final List<ConstructorReferenceBuilder> constructorReferences; 54 final List<ConstructorReferenceBuilder> constructorReferences;
55 55
56 final KernelTypeBuilder mixedInType;
57
56 SourceClassBuilder(List<MetadataBuilder> metadata, int modifiers, 58 SourceClassBuilder(List<MetadataBuilder> metadata, int modifiers,
57 String name, List<TypeVariableBuilder> typeVariables, 59 String name, List<TypeVariableBuilder> typeVariables,
58 KernelTypeBuilder supertype, List<KernelTypeBuilder>interfaces, 60 KernelTypeBuilder supertype, List<KernelTypeBuilder> interfaces,
59 Map<String, Builder> members, LibraryBuilder parent, 61 Map<String, Builder> members, LibraryBuilder parent,
60 this.constructorReferences, int charOffset, [Class cls]) 62 this.constructorReferences, int charOffset, [Class cls, this.mixedInType])
61 : cls = initializeClass(cls, name, parent, charOffset), 63 : cls = initializeClass(cls, name, parent, charOffset),
62 membersInScope = computeMembersInScope(members), 64 membersInScope = computeMembersInScope(members),
63 constructors = computeConstructors(members), 65 constructors = computeConstructors(members),
64 super(metadata, modifiers, name, typeVariables, supertype, interfaces, 66 super(metadata, modifiers, name, typeVariables, supertype, interfaces,
65 members, parent, charOffset); 67 members, parent, charOffset);
66 68
67 int resolveTypes(LibraryBuilder library) { 69 int resolveTypes(LibraryBuilder library) {
68 int count = 0; 70 int count = 0;
69 if (typeVariables != null) { 71 if (typeVariables != null) {
70 for (KernelTypeVariableBuilder t in typeVariables) { 72 for (KernelTypeVariableBuilder t in typeVariables) {
(...skipping 17 matching lines...) Expand all
88 internalError("Unhandled builder: ${builder.runtimeType}"); 90 internalError("Unhandled builder: ${builder.runtimeType}");
89 } 91 }
90 } 92 }
91 members.forEach((String name, Builder builder) { 93 members.forEach((String name, Builder builder) {
92 do { 94 do {
93 buildBuilder(builder); 95 buildBuilder(builder);
94 builder = builder.next; 96 builder = builder.next;
95 } while (builder != null); 97 } while (builder != null);
96 }); 98 });
97 cls.supertype = supertype?.buildSupertype(); 99 cls.supertype = supertype?.buildSupertype();
100 cls.mixedInType = mixedInType?.buildSupertype();
98 // TODO(ahe): If `cls.supertype` is null, and this isn't Object, report a 101 // TODO(ahe): If `cls.supertype` is null, and this isn't Object, report a
99 // compile-time error. 102 // compile-time error.
100 cls.isAbstract = isAbstract; 103 cls.isAbstract = isAbstract;
101 if (interfaces != null) { 104 if (interfaces != null) {
102 for (KernelTypeBuilder interface in interfaces) { 105 for (KernelTypeBuilder interface in interfaces) {
103 Supertype supertype = interface.buildSupertype(); 106 Supertype supertype = interface.buildSupertype();
104 if (supertype != null) { 107 if (supertype != null) {
105 // TODO(ahe): Report an error if supertype is null. 108 // TODO(ahe): Report an error if supertype is null.
106 cls.implementedTypes.add(supertype); 109 cls.implementedTypes.add(supertype);
107 } 110 }
(...skipping 28 matching lines...) Expand all
136 Map<String, Builder> computeConstructors(Map<String, Builder> members) { 139 Map<String, Builder> computeConstructors(Map<String, Builder> members) {
137 Map<String, Builder> constructors = <String, Builder>{}; 140 Map<String, Builder> constructors = <String, Builder>{};
138 members.forEach((String name, Builder builder) { 141 members.forEach((String name, Builder builder) {
139 if (builder is ProcedureBuilder && 142 if (builder is ProcedureBuilder &&
140 (builder.isConstructor || builder.isFactory)) { 143 (builder.isConstructor || builder.isFactory)) {
141 constructors[name] = builder; 144 constructors[name] = builder;
142 } 145 }
143 }); 146 });
144 return constructors; 147 return constructors;
145 } 148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698