| 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.ast.DartFunctionExpression; | 10 import com.google.dart.compiler.ast.DartFunctionExpression; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 Element existingElement = scope.findElement(scope.getLibrary(), name); | 74 Element existingElement = scope.findElement(scope.getLibrary(), name); |
| 75 if (existingElement != null) { | 75 if (existingElement != null) { |
| 76 if (!Elements.isConstructorParameter(element) | 76 if (!Elements.isConstructorParameter(element) |
| 77 && !Elements.isParameterOfMethodWithoutBody(element) | 77 && !Elements.isParameterOfMethodWithoutBody(element) |
| 78 && !(Elements.isStaticContext(element) && !Elements.isStaticContext(
existingElement)) | 78 && !(Elements.isStaticContext(element) && !Elements.isStaticContext(
existingElement)) |
| 79 && !existingElement.getModifiers().isAbstractField()) { | 79 && !existingElement.getModifiers().isAbstractField()) { |
| 80 DartNode nameNode = Elements.getNameNode(element); | 80 DartNode nameNode = Elements.getNameNode(element); |
| 81 String existingLocation = Elements.getRelativeElementLocation(element,
existingElement); | 81 String existingLocation = Elements.getRelativeElementLocation(element,
existingElement); |
| 82 // TODO(scheglov) remove condition once HTML will be fixed to don't ha
ve duplicates. | 82 // TODO(scheglov) remove condition once HTML will be fixed to don't ha
ve duplicates. |
| 83 // http://code.google.com/p/dart/issues/detail?id=1060 | 83 // http://code.google.com/p/dart/issues/detail?id=1060 |
| 84 if (!Elements.isLibrarySource(element.getNode().getSource(), "htmlimpl
.dart") | 84 if (!Elements.isLibrarySource(element.getNode().getSource(), "html.dar
t") |
| 85 && !Elements.isLibrarySource(element.getNode().getSource(), "dom.d
art")) { | 85 && !Elements.isLibrarySource(element.getNode().getSource(), "dom.d
art")) { |
| 86 onError(nameNode, warningCode, name, existingElement, existingLocati
on); | 86 onError(nameNode, warningCode, name, existingElement, existingLocati
on); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 // Check for duplicate declaration in the same scope. | 91 // Check for duplicate declaration in the same scope. |
| 92 if (existingLocalElement != null && errorCode != null) { | 92 if (existingLocalElement != null && errorCode != null) { |
| 93 DartNode nameNode = Elements.getNameNode(element); | 93 DartNode nameNode = Elements.getNameNode(element); |
| 94 String existingLocation = Elements.getRelativeElementLocation(element, exi
stingLocalElement); | 94 String existingLocation = Elements.getRelativeElementLocation(element, exi
stingLocalElement); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 return null; | 368 return null; |
| 369 } | 369 } |
| 370 | 370 |
| 371 @Override | 371 @Override |
| 372 public Element visitIdentifier(DartIdentifier node) { | 372 public Element visitIdentifier(DartIdentifier node) { |
| 373 String name = node.getTargetName(); | 373 String name = node.getTargetName(); |
| 374 return scope.findElement(scope.getLibrary(), name); | 374 return scope.findElement(scope.getLibrary(), name); |
| 375 } | 375 } |
| 376 } | 376 } |
| 377 } | 377 } |
| OLD | NEW |