| 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 | 6 |
| 7 import com.google.common.annotations.VisibleForTesting; | 7 import com.google.common.annotations.VisibleForTesting; |
| 8 import com.google.common.collect.Maps; | 8 import com.google.common.collect.Maps; |
| 9 import com.google.dart.compiler.DartCompilationError; | 9 import com.google.dart.compiler.DartCompilationError; |
| 10 import com.google.dart.compiler.DartCompilerContext; | 10 import com.google.dart.compiler.DartCompilerContext; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 private void compilationError(DartCompilerListener listener, SourceInfo node,
ErrorCode errorCode, | 116 private void compilationError(DartCompilerListener listener, SourceInfo node,
ErrorCode errorCode, |
| 117 Object... args) { | 117 Object... args) { |
| 118 DartCompilationError error = new DartCompilationError(node, errorCode, args)
; | 118 DartCompilationError error = new DartCompilationError(node, errorCode, args)
; |
| 119 listener.onError(error); | 119 listener.onError(error); |
| 120 } | 120 } |
| 121 | 121 |
| 122 private void declare(Element newElement, DartCompilerListener listener, Scope
scope) { | 122 private void declare(Element newElement, DartCompilerListener listener, Scope
scope) { |
| 123 Element oldElement = scope.declareElement(newElement.getName(), newElement); | 123 Element oldElement = scope.declareElement(newElement.getName(), newElement); |
| 124 // We had already node with such name, report duplicate. | 124 // We had already node with such name, report duplicate. |
| 125 if (oldElement != null) { | 125 if (oldElement != null) { |
| 126 // ignore "assert" |
| 127 if (Elements.isArtificialAssertMethod(oldElement)) { |
| 128 return; |
| 129 } |
| 126 // Getter/setter can shared same name, but not setter/setter and getter/ge
tter. | 130 // Getter/setter can shared same name, but not setter/setter and getter/ge
tter. |
| 127 if (newElement.getModifiers().isAbstractField() | 131 if (newElement.getModifiers().isAbstractField() |
| 128 && oldElement.getModifiers().isAbstractField()) { | 132 && oldElement.getModifiers().isAbstractField()) { |
| 129 if (newElement.getModifiers().isGetter() && !oldElement.getModifiers().i
sGetter()) { | 133 if (newElement.getModifiers().isGetter() && !oldElement.getModifiers().i
sGetter()) { |
| 130 return; | 134 return; |
| 131 } | 135 } |
| 132 if (newElement.getModifiers().isSetter() && !oldElement.getModifiers().i
sSetter()) { | 136 if (newElement.getModifiers().isSetter() && !oldElement.getModifiers().i
sSetter()) { |
| 133 return; | 137 return; |
| 134 } | 138 } |
| 135 } | 139 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 Modifiers modifiers = node.getModifiers(); | 198 Modifiers modifiers = node.getModifiers(); |
| 195 if (modifiers.isFinal()) { | 199 if (modifiers.isFinal()) { |
| 196 // final toplevel fields are implicitly compile-time constants. | 200 // final toplevel fields are implicitly compile-time constants. |
| 197 modifiers = modifiers.makeConstant(); | 201 modifiers = modifiers.makeConstant(); |
| 198 } | 202 } |
| 199 node.setElement(Elements.fieldFromNode(node, library, modifiers)); | 203 node.setElement(Elements.fieldFromNode(node, library, modifiers)); |
| 200 return null; | 204 return null; |
| 201 } | 205 } |
| 202 } | 206 } |
| 203 } | 207 } |
| OLD | NEW |