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

Unified Diff: lib/compiler/implementation/resolver.dart

Issue 10854216: Fix for class members cannot have the same name as the class in dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | lib/compiler/implementation/warnings.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/resolver.dart
diff --git a/lib/compiler/implementation/resolver.dart b/lib/compiler/implementation/resolver.dart
index 132050d262edc7db89d26cdf70847d240fa79aab..73eb2cb8ff9be003dd6ac5cb15d848c49d63f151 100644
--- a/lib/compiler/implementation/resolver.dart
+++ b/lib/compiler/implementation/resolver.dart
@@ -119,6 +119,9 @@ class ResolverTask extends CompilerTask {
}
FunctionExpression tree = element.parseNode(compiler);
if (isConstructor) {
+ if (tree.returnType !== null) {
+ error(tree, MessageKind.CONSTRUCTOR_WITH_RETURN_TYPE);
+ }
resolveConstructorImplementation(element, tree);
}
ResolverVisitor visitor = new ResolverVisitor(compiler, element);
@@ -281,6 +284,27 @@ class ResolverTask extends CompilerTask {
void checkMembers(ClassElement cls) {
if (cls === compiler.objectClass) return;
cls.forEachMember((holder, member) {
+
+ // Check modifiers.
+ if (member.isFunction() && member.modifiers.isFinal()) {
+ compiler.reportMessage(
+ compiler.spanFromElement(member),
+ MessageKind.ILLEGAL_FINAL_METHOD_MODIFIER.error(),
+ api.Diagnostic.ERROR);
+ }
+ if (member.isConstructor()) {
+ final mismatchedFlagsBits =
+ member.modifiers.flags &
+ (Modifiers.FLAG_STATIC | Modifiers.FLAG_ABSTRACT);
+ if (mismatchedFlagsBits != 0) {
+ final mismatchedFlags =
+ new Modifiers.withFlags(null, mismatchedFlagsBits);
+ compiler.reportMessage(
+ compiler.spanFromElement(member),
+ MessageKind.ILLEGAL_CONSTRUCTOR_MODIFIERS.error([mismatchedFlags]),
+ api.Diagnostic.ERROR);
+ }
+ }
checkAbstractField(member);
checkValidOverride(member, cls.lookupSuperMember(member.name));
});
« no previous file with comments | « no previous file | lib/compiler/implementation/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698