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

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

Issue 10855140: Issue 3562. Analyzer should not warn about shadowing (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: compiler/java/com/google/dart/compiler/resolver/Resolver.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/Resolver.java b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
index 46e5953b134296a849f293782b1a23addb81db61..a5a5fa93c38501fa21d3b213873e7281c1a57780 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Resolver.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
@@ -244,8 +244,7 @@ public class Resolver {
}
getContext().declare(
parameter.getElement(),
- ResolverErrorCode.DUPLICATE_PARAMETER,
- ResolverErrorCode.DUPLICATE_PARAMETER_WARNING);
+ ResolverErrorCode.DUPLICATE_PARAMETER);
}
}
@@ -482,7 +481,6 @@ public class Resolver {
* Check that used type variables are unique and don't shadow and existing elements.
*/
private void checkClassTypeVariables(ClassElement classElement) {
- Scope scope = context.getScope();
Set<String> declaredVariableNames = Sets.newHashSet();
for (Type type : classElement.getTypeParameters()) {
if (type instanceof TypeVariable) {
@@ -494,16 +492,6 @@ public class Resolver {
} else {
declaredVariableNames.add(name);
}
- // Check that type variable is not shadowing any element in enclosing context.
- Element existingElement = scope.findElement(scope.getLibrary(), name);
- if (existingElement != null) {
- onError(
- typeVariableElement,
- ResolverErrorCode.DUPLICATE_TYPE_VARIABLE_WARNING,
- name,
- Elements.getUserElementTitle(existingElement),
- Elements.getRelativeElementLocation(typeVariableElement, existingElement));
- }
}
}
}
@@ -627,8 +615,7 @@ public class Resolver {
if (!(parameter.getQualifier() instanceof DartThisExpression)) {
getContext().declare(
parameter.getElement(),
- ResolverErrorCode.DUPLICATE_PARAMETER,
- ResolverErrorCode.DUPLICATE_PARAMETER_WARNING);
+ ResolverErrorCode.DUPLICATE_PARAMETER);
}
}
for (DartParameter parameter : parameters) {
@@ -725,8 +712,7 @@ public class Resolver {
resolve(x.getDefaultExpr());
getContext().declare(
element,
- ResolverErrorCode.DUPLICATE_PARAMETER,
- ResolverErrorCode.DUPLICATE_PARAMETER_WARNING);
+ ResolverErrorCode.DUPLICATE_PARAMETER);
return element;
}
@@ -736,8 +722,7 @@ public class Resolver {
VariableElement element = Elements.variableElement(enclosingElement, x, x.getVariableName(), modifiers);
getContext().declare(
recordElement(x, element),
- ResolverErrorCode.DUPLICATE_LOCAL_VARIABLE_ERROR,
- ResolverErrorCode.DUPLICATE_LOCAL_VARIABLE_WARNING);
+ ResolverErrorCode.DUPLICATE_LOCAL_VARIABLE_ERROR);
recordElement(x.getName(), element);
return element;
}

Powered by Google App Engine
This is Rietveld 408576698