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

Unified Diff: lib/compiler/implementation/scanner/class_element_parser.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
Index: lib/compiler/implementation/scanner/class_element_parser.dart
diff --git a/lib/compiler/implementation/scanner/class_element_parser.dart b/lib/compiler/implementation/scanner/class_element_parser.dart
index 02f6eaab530429b9ea26a40f8ea34c8083672ed1..0a117e2d0e2395a3bf370842cd0753f651294960 100644
--- a/lib/compiler/implementation/scanner/class_element_parser.dart
+++ b/lib/compiler/implementation/scanner/class_element_parser.dart
@@ -22,6 +22,7 @@ class PartialClassElement extends ClassElement {
ClassNode parseNode(DiagnosticListener diagnosticListener) {
if (cachedNode != null) return cachedNode;
+
MemberListener listener = new MemberListener(diagnosticListener, this);
Parser parser = new ClassElementParser(listener);
Token token = parser.parseTopLevelDeclaration(beginToken);
@@ -109,10 +110,18 @@ class MemberListener extends NodeListener {
bool isConstructor = isConstructorName(method.name);
SourceString name = getMethodNameHack(method.name);
ElementKind kind = ElementKind.FUNCTION;
+ Modifiers modifiers = method.modifiers;
+ if (modifiers.isFinal()) {
+ recoverableError('illegal modifier', node: modifiers);
ahe 2012/08/24 08:32:18 I would rather catch this in the resolver.
+ }
if (isConstructor) {
if (getOrSet !== null) {
recoverableError('illegal modifier', token: getOrSet);
}
+ if (modifiers.isStatic() ||
+ modifiers.isAbstract()) {
+ recoverableError('illegal modifier', node: modifiers);
ahe 2012/08/24 08:32:18 Ditto.
+ }
kind = ElementKind.GENERATIVE_CONSTRUCTOR;
} else if (getOrSet !== null) {
kind = (getOrSet.stringValue === 'get')

Powered by Google App Engine
This is Rietveld 408576698