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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/ClassElementImplementation.java

Issue 8728001: Support for 'abstract' modifier for class and spec recommended warnings, issue 375 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge. Warning for factory constructor of abstract class. Created 9 years 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: compiler/java/com/google/dart/compiler/resolver/ClassElementImplementation.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/ClassElementImplementation.java b/compiler/java/com/google/dart/compiler/resolver/ClassElementImplementation.java
index 3e6b2ae5cdd577acd1b726919851b33d9d09dd59..2693423f4da18c0413200bfe6ccd8451ffa70d8f 100644
--- a/compiler/java/com/google/dart/compiler/resolver/ClassElementImplementation.java
+++ b/compiler/java/com/google/dart/compiler/resolver/ClassElementImplementation.java
@@ -7,6 +7,7 @@ package com.google.dart.compiler.resolver;
import com.google.dart.compiler.ast.DartClass;
import com.google.dart.compiler.ast.DartDeclaration;
import com.google.dart.compiler.ast.DartStringLiteral;
+import com.google.dart.compiler.ast.Modifiers;
import com.google.dart.compiler.type.InterfaceType;
import com.google.dart.compiler.type.Type;
import com.google.dart.compiler.type.TypeKind;
@@ -29,6 +30,7 @@ class ClassElementImplementation extends AbstractElement implements ClassElement
private Set<InterfaceType> immediateSubtypes = new HashSet<InterfaceType>();
private final boolean isInterface;
private final String nativeName;
+ private final Modifiers modifiers;
private final AtomicReference<List<InterfaceType>> allSupertypes =
new AtomicReference<List<InterfaceType>>();
@@ -57,8 +59,10 @@ class ClassElementImplementation extends AbstractElement implements ClassElement
interfaces = new ArrayList<InterfaceType>();
if (node != null) {
isInterface = node.isInterface();
+ modifiers = node.getModifiers();
} else {
isInterface = false;
+ modifiers = Modifiers.NONE;
}
}
@@ -176,6 +180,11 @@ class ClassElementImplementation extends AbstractElement implements ClassElement
}
@Override
+ public Modifiers getModifiers() {
+ return modifiers;
+ }
+
+ @Override
public LibraryElement getLibrary() {
return library;
}
@@ -297,6 +306,19 @@ class ClassElementImplementation extends AbstractElement implements ClassElement
}
@Override
+ public boolean isAbstract() {
+ if (modifiers.isAbstract()) {
+ return true;
+ }
+ for (Element element : getMembers()) {
+ if (element.getModifiers().isAbstract()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
public EnclosingElement getEnclosingElement() {
return library;
}

Powered by Google App Engine
This is Rietveld 408576698