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

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

Issue 2862223002: Rewrite mixin application handling in Fasta. (Closed)
Patch Set: Update status file. Created 3 years, 7 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/kernel_mixin_application_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_mixin_application_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_mixin_application_builder.dart
index 9c46ba8cda3ab35465af3bf0eb4ceed25abf0233..1978c66b74564c33c379c86fc11a383c66458f2f 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_mixin_application_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_mixin_application_builder.dart
@@ -4,26 +4,18 @@
library fasta.kernel_mixin_application_builder;
-import 'package:kernel/ast.dart' show InterfaceType, Supertype, setParents;
+import 'package:kernel/ast.dart' show InterfaceType, Supertype;
-import '../modifier.dart' show abstractMask;
-
-import '../source/source_class_builder.dart' show SourceClassBuilder;
+import '../errors.dart' show internalError;
import '../util/relativize.dart' show relativizeUri;
import 'kernel_builder.dart'
show
- ConstructorReferenceBuilder,
KernelLibraryBuilder,
- KernelNamedTypeBuilder,
KernelTypeBuilder,
- KernelTypeVariableBuilder,
LibraryBuilder,
- MemberBuilder,
MixinApplicationBuilder,
- Scope,
- TypeBuilder,
TypeVariableBuilder;
class KernelMixinApplicationBuilder
@@ -48,72 +40,10 @@ class KernelMixinApplicationBuilder
super(supertype, mixins, charOffset, fileUri);
InterfaceType build(LibraryBuilder library) {
- return buildSupertype(library)?.asInterfaceType;
+ return internalError("Unsupported operation.");
}
Supertype buildSupertype(LibraryBuilder library) {
- if (builtType != null) return builtType;
- KernelTypeBuilder s = this.supertype;
- for (KernelTypeBuilder builder in mixins) {
- s = applyMixin(s, builder);
- }
- builtType = s.buildSupertype(library);
- return builtType;
- }
-
- TypeBuilder applyMixin(TypeBuilder supertype, TypeBuilder mixin) {
- KernelLibraryBuilder library = this.library.partOfLibrary ?? this.library;
- List<KernelTypeBuilder> typeArguments;
- List<TypeVariableBuilder> newTypeVariables;
- if (typeVariables != null) {
- assert(subclassName != null);
- newTypeVariables = library.copyTypeVariables(typeVariables);
- Map<TypeVariableBuilder, TypeBuilder> substitution =
- <TypeVariableBuilder, TypeBuilder>{};
- typeArguments = <KernelTypeBuilder>[];
- for (int i = 0; i < typeVariables.length; i++) {
- substitution[typeVariables[i]] = newTypeVariables[i].asTypeBuilder();
- typeArguments.add(typeVariables[i].asTypeBuilder());
- }
- supertype = supertype.subst(substitution);
- mixin = mixin.subst(substitution);
- }
- // To reduce diff against dartk, we create a different name for mixin
- // applications that have free type variables. We do this by setting
- // [subclassName] when setting typeVariables.
- String name = subclassName != null
- ? "${subclassName}^${mixin.name}"
- : "${supertype.name}&${mixin.name}";
-
- SourceClassBuilder cls =
- library.mixinApplicationClasses.putIfAbsent(name, () {
- SourceClassBuilder cls = new SourceClassBuilder(
- null,
- abstractMask,
- name,
- newTypeVariables,
- supertype,
- null,
- new Scope(<String, MemberBuilder>{}, <String, MemberBuilder>{},
- library.scope.withTypeVariables(newTypeVariables),
- isModifiable: false),
- new Scope(<String, MemberBuilder>{}, null, null, isModifiable: false),
- library,
- <ConstructorReferenceBuilder>[],
- charOffset,
- null,
- mixin);
- library.addImplementationBuilder(name, cls, charOffset);
- if (newTypeVariables != null) {
- for (KernelTypeVariableBuilder t in newTypeVariables) {
- cls.cls.typeParameters.add(t.parameter);
- }
- setParents(cls.cls.typeParameters, cls.cls);
- }
- return cls;
- });
- return new KernelNamedTypeBuilder(
- name, typeArguments, charOffset, library.fileUri)
- ..builder = cls;
+ return internalError("Unsupported operation.");
}
}

Powered by Google App Engine
This is Rietveld 408576698