| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package com.google.dart.compiler.resolver; | 5 package com.google.dart.compiler.resolver; |
| 6 import com.google.common.annotations.VisibleForTesting; | 6 import com.google.common.annotations.VisibleForTesting; |
| 7 import com.google.dart.compiler.DartCompilationError; | 7 import com.google.dart.compiler.DartCompilationError; |
| 8 import com.google.dart.compiler.DartCompilerContext; | 8 import com.google.dart.compiler.DartCompilerContext; |
| 9 import com.google.dart.compiler.ErrorCode; | 9 import com.google.dart.compiler.ErrorCode; |
| 10 import com.google.dart.compiler.ErrorSeverity; | 10 import com.google.dart.compiler.ErrorSeverity; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // Check for duplicate declaration in the enclosing scope. | 84 // Check for duplicate declaration in the enclosing scope. |
| 85 if (existingLocalElement == null && warningCode != null) { | 85 if (existingLocalElement == null && warningCode != null) { |
| 86 Element existingElement = scope.findElement(scope.getLibrary(), name); | 86 Element existingElement = scope.findElement(scope.getLibrary(), name); |
| 87 if (existingElement != null) { | 87 if (existingElement != null) { |
| 88 if (!Elements.isConstructorParameter(element) | 88 if (!Elements.isConstructorParameter(element) |
| 89 && !Elements.isParameterOfMethodWithoutBody(element) | 89 && !Elements.isParameterOfMethodWithoutBody(element) |
| 90 && !(Elements.isStaticContext(element) && !Elements.isStaticContext(
existingElement)) | 90 && !(Elements.isStaticContext(element) && !Elements.isStaticContext(
existingElement)) |
| 91 && !existingElement.getModifiers().isAbstractField() | 91 && !existingElement.getModifiers().isAbstractField() |
| 92 && !Elements.isArtificialAssertMethod(existingElement)) { | 92 && !Elements.isArtificialAssertMethod(existingElement)) { |
| 93 SourceInfo nameSourceInfo = element.getNameLocation(); | 93 SourceInfo nameSourceInfo = element.getNameLocation(); |
| 94 String existingTitle = Elements.getUserElementTitle(existingElement); |
| 94 String existingLocation = Elements.getRelativeElementLocation(element,
existingElement); | 95 String existingLocation = Elements.getRelativeElementLocation(element,
existingElement); |
| 95 if (existingElement.getKind() == ElementKind.LIBRARY_PREFIX) { | 96 if (existingElement.getKind() == ElementKind.LIBRARY_PREFIX) { |
| 96 onError(nameSourceInfo, ResolverErrorCode.CANNOT_HIDE_IMPORT_PREFIX,
name); | 97 onError(nameSourceInfo, ResolverErrorCode.CANNOT_HIDE_IMPORT_PREFIX,
name); |
| 97 } else { | 98 } else { |
| 98 onError(nameSourceInfo, warningCode, name, existingElement, existing
Location); | 99 onError(nameSourceInfo, warningCode, name, existingTitle, existingLo
cation); |
| 99 } | 100 } |
| 100 } | 101 } |
| 101 } | 102 } |
| 102 } | 103 } |
| 103 // Check for duplicate declaration in the same scope. | 104 // Check for duplicate declaration in the same scope. |
| 104 if (existingLocalElement != null && errorCode != null) { | 105 if (existingLocalElement != null && errorCode != null) { |
| 105 SourceInfo nameSourceInfo = element.getNameLocation(); | 106 SourceInfo nameSourceInfo = element.getNameLocation(); |
| 106 String existingLocation = Elements.getRelativeElementLocation(element, exi
stingLocalElement); | 107 String existingLocation = Elements.getRelativeElementLocation(element, exi
stingLocalElement); |
| 107 onError(nameSourceInfo, errorCode, name, existingLocation); | 108 onError(nameSourceInfo, errorCode, name, existingLocation); |
| 108 } | 109 } |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 String name = node.getName(); | 424 String name = node.getName(); |
| 424 return scope.findElement(scope.getLibrary(), name); | 425 return scope.findElement(scope.getLibrary(), name); |
| 425 } | 426 } |
| 426 | 427 |
| 427 @Override | 428 @Override |
| 428 public Element visitSyntheticErrorIdentifier(DartSyntheticErrorIdentifier no
de) { | 429 public Element visitSyntheticErrorIdentifier(DartSyntheticErrorIdentifier no
de) { |
| 429 return Elements.dynamicElement(); | 430 return Elements.dynamicElement(); |
| 430 } | 431 } |
| 431 } | 432 } |
| 432 } | 433 } |
| OLD | NEW |