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

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

Issue 11953012: Add more mixin tests and start rejecting illegal syntax. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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: 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 aeef67258f2ceb627636a427f5138e5aff64184e..a59db33e345eea011bc1c1219d23ebae9554ba80 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -489,7 +489,29 @@ class ResolverTask extends CompilerTask {
}
}
- void checkMembers(ClassElement cls) {
+ void checkClass(ClassElement element) {
+ if (element.isMixinApplication) {
+ checkMixinApplication(element);
+ } else {
+ checkClassMembers(element);
+ }
+ }
+
+ void checkMixinApplication(MixinApplicationElement mixin) {
+ Modifiers modifiers = mixin.modifiers;
+ int illegalFlags = modifiers.flags & ~Modifiers.FLAG_ABSTRACT;
+ if (illegalFlags != 0) {
+ Modifiers illegalModifiers = new Modifiers.withFlags(null, illegalFlags);
+ MessageKind messageKind =
+ MessageKind.ILLEGAL_MIXIN_APPLICATION_MODIFIERS.error(
+ [illegalModifiers]);
+ compiler.reportMessage(compiler.spanFromSpannable(modifiers),
+ messageKind,
+ Diagnostic.ERROR);
+ }
+ }
+
+ void checkClassMembers(ClassElement cls) {
assert(invariant(cls, cls.isDeclaration));
if (cls.isObject(compiler)) return;
// TODO(johnniwinther): Should this be done on the implementation element as
@@ -2837,7 +2859,8 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
new SourceString("${superName}_${mixinName}"),
element.getCompilationUnit(),
compiler.getNextFreeClassId(),
- element.parseNode(compiler));
+ element.parseNode(compiler),
+ Modifiers.EMPTY); // TODO(kasperl): Should this be abstract?
doApplyMixinTo(mixinApplication, supertype, mixinType);
mixinApplication.resolutionState = STATE_DONE;
mixinApplication.supertypeLoadState = STATE_DONE;

Powered by Google App Engine
This is Rietveld 408576698