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

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

Issue 10696056: Fix for issues 3729 and 3523 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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: compiler/java/com/google/dart/compiler/resolver/Resolver.java
===================================================================
--- compiler/java/com/google/dart/compiler/resolver/Resolver.java (revision 9267)
+++ compiler/java/com/google/dart/compiler/resolver/Resolver.java (working copy)
@@ -1288,6 +1288,10 @@
if (x.getQualifier() instanceof DartThisExpression) {
Element foundElement = Elements.findElement(currentHolder, x.getPropertyName());
if (foundElement != null && !foundElement.getModifiers().isStatic()) {
+ if (ElementKind.of(foundElement) == ElementKind.TYPE_VARIABLE) {
+ onError(x.getQualifier(), ResolverErrorCode.TYPE_VARIABLE_NOT_ALLOWED_IN_IDENTIFIER);
+ break;
+ }
element = foundElement;
}
}
@@ -2192,13 +2196,16 @@
List<DartInitializer> inits = ((DartMethodDefinition) constructor.getNode()).getInitializers();
// Parser ensures that redirected constructors can be the only item in the initialization list.
if (inits.size() == 1) {
- Element element = inits.get(0).getValue().getElement();
- if (ElementKind.of(element).equals(ElementKind.CONSTRUCTOR)) {
- ConstructorElement nextConstructorElement = (ConstructorElement) element;
- ClassElement nextClass = (ClassElement) nextConstructorElement.getEnclosingElement();
- ClassElement currentClass = (ClassElement) constructor.getEnclosingElement();
- if (nextClass == currentClass) {
- return (ConstructorNodeElement) nextConstructorElement;
+ DartExpression value = inits.get(0).getValue();
+ if (value != null) {
+ Element element = value.getElement();
+ if (ElementKind.of(element).equals(ElementKind.CONSTRUCTOR)) {
+ ConstructorElement nextConstructorElement = (ConstructorElement) element;
+ ClassElement nextClass = (ClassElement) nextConstructorElement.getEnclosingElement();
+ ClassElement currentClass = (ClassElement) constructor.getEnclosingElement();
+ if (nextClass == currentClass) {
+ return (ConstructorNodeElement) nextConstructorElement;
+ }
}
}
}

Powered by Google App Engine
This is Rietveld 408576698