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

Unified Diff: frog/member.dart

Issue 8485002: more negative test fixes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month 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 | « frog/gen.dart ('k') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/member.dart
diff --git a/frog/member.dart b/frog/member.dart
index 5865e200c06dcc7923cce43b33196b42944391f5..5881ecf7a6f1646fc3d1745c34244a8dca762711 100644
--- a/frog/member.dart
+++ b/frog/member.dart
@@ -32,9 +32,6 @@ class Parameter {
if (method.isAbstract) {
world.error('default value not allowed on abstract methods',
definition.span);
- } else if (!inType.isClass) {
- world.error('default value not allowed on interface methods',
- definition.span);
} else if (method.name == '\$call' && method.definition.body == null) {
// TODO(jimhug): Need simpler way to detect "true" function types vs.
// regular methods being used as function types for closures.
@@ -1159,7 +1156,7 @@ class MethodMember extends Member {
isStatic = inType.isTop;
isConst = false;
isFactory = false;
- isAbstract = false;
+ isAbstract = !declaringType.isClass;
if (definition.modifiers != null) {
for (var mod in definition.modifiers) {
if (mod.kind == TokenKind.STATIC) {
@@ -1179,7 +1176,12 @@ class MethodMember extends Member {
isFactory = true;
} else if (mod.kind == TokenKind.ABSTRACT) {
if (isAbstract) {
- world.error('duplicate abstract modifier', mod.span);
+ if (declaringType.isClass) {
+ world.error('duplicate abstract modifier', mod.span);
+ } else {
+ world.error('abstract modifier not allowed on interface members',
+ mod.span);
+ }
}
isAbstract = true;
} else {
@@ -1193,15 +1195,21 @@ class MethodMember extends Member {
}
if (isAbstract) {
- if (definition.body != null) {
+ if (definition.body != null &&
+ declaringType.definition is! FunctionTypeDefinition) {
+ // TODO(jimhug): Creating function types for concrete methods is
+ // steadily feeling uglier...
world.error('abstract method can not have a body',
definition.body.span);
}
- if (isStatic) {
+ if (isStatic &&
+ declaringType.definition is! FunctionTypeDefinition) {
world.error('static method can not be abstract', definition.span);
}
} else {
- // TODO(jimhug): proper checks for bodies on non-interfaces
+ if (definition.body == null && !isConstructor) {
+ world.error('method needs a body', span);
+ }
}
if (isConstructor) {
« no previous file with comments | « frog/gen.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698