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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/ResolutionContext.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/ResolutionContext.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java b/compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java
index 69bfd943940ca986a234b93dc3e9eadd98f0fe53..0e03995e3bb8c6135b0d242b864a5fd526935f79 100644
--- a/compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java
+++ b/compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java
@@ -78,26 +78,16 @@ public class ResolutionContext implements ResolutionErrorListener {
return scope;
}
- void declare(Element element, ErrorCode errorCode, ErrorCode warningCode) {
+ void declare(Element element, ErrorCode errorCode) {
String name = element.getName();
Element existingLocalElement = scope.findLocalElement(name);
// Check for duplicate declaration in the enclosing scope.
- if (existingLocalElement == null && warningCode != null) {
+ if (existingLocalElement == null) {
Element existingElement = scope.findElement(scope.getLibrary(), name);
if (existingElement != null) {
- if (!Elements.isConstructorParameter(element)
- && !Elements.isParameterOfMethodWithoutBody(element)
- && !(Elements.isStaticContext(element) && !Elements.isStaticContext(existingElement))
- && !existingElement.getModifiers().isAbstractField()
- && !Elements.isArtificialAssertMethod(existingElement)) {
- SourceInfo nameSourceInfo = element.getNameLocation();
- String existingTitle = Elements.getUserElementTitle(existingElement);
- String existingLocation = Elements.getRelativeElementLocation(element, existingElement);
- if (existingElement.getKind() == ElementKind.LIBRARY_PREFIX) {
- onError(nameSourceInfo, ResolverErrorCode.CANNOT_HIDE_IMPORT_PREFIX, name);
- } else {
- onError(nameSourceInfo, warningCode, name, existingTitle, existingLocation);
- }
+ SourceInfo nameSourceInfo = element.getNameLocation();
+ if (existingElement.getKind() == ElementKind.LIBRARY_PREFIX) {
+ onError(nameSourceInfo, ResolverErrorCode.CANNOT_HIDE_IMPORT_PREFIX, name);
}
}
}
@@ -362,8 +352,7 @@ public class ResolutionContext implements ResolutionErrorListener {
if (node.getFunctionName() != null) {
declare(
element,
- ResolverErrorCode.DUPLICATE_FUNCTION_EXPRESSION,
- ResolverErrorCode.DUPLICATE_FUNCTION_EXPRESSION_WARNING);
+ ResolverErrorCode.DUPLICATE_FUNCTION_EXPRESSION);
}
return element;
}

Powered by Google App Engine
This is Rietveld 408576698