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

Unified Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 25844002: Check mixin of black-listed types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years, 2 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/warnings.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/resolution/members.dart
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index 7a27b1d398e436ca27dc88b2d924da81808c55bf..af4208d99a8d82be92939d07090a6f0739349aa1 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -3606,7 +3606,8 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
DartType supertype = resolveSupertype(element, superMixin.superclass);
Link<Node> link = superMixin.mixins.nodes;
while (!link.isEmpty) {
- supertype = applyMixin(supertype, resolveType(link.head), node);
+ supertype = applyMixin(
+ supertype, checkMixinType(link.head), link.head);
link = link.tail;
}
element.supertype = supertype;
@@ -3657,6 +3658,17 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
return element.computeType(compiler);
}
+ /// Resolves the mixed type for [mixinNode] and checks that the the mixin type
+ /// is not black-listed. The mixin type is returned.
+ DartType checkMixinType(TypeAnnotation mixinNode) {
+ DartType mixinType = resolveType(mixinNode);
+ if (isBlackListed(mixinType)) {
+ compiler.reportError(mixinNode,
+ MessageKind.CANNOT_MIXIN, {'type': mixinType});
+ }
+ return mixinType;
+ }
+
DartType visitNamedMixinApplication(NamedMixinApplication node) {
compiler.ensure(element != null);
compiler.ensure(element.resolutionState == STATE_STARTED);
@@ -3670,10 +3682,10 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
DartType supertype = resolveSupertype(element, node.superclass);
Link<Node> link = node.mixins.nodes;
while (!link.tail.isEmpty) {
- supertype = applyMixin(supertype, resolveType(link.head), link.head);
+ supertype = applyMixin(supertype, checkMixinType(link.head), link.head);
link = link.tail;
}
- doApplyMixinTo(element, supertype, resolveType(link.head));
+ doApplyMixinTo(element, supertype, checkMixinType(link.head));
return element.computeType(compiler);
}
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698