OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
11 * or implied. See the License for the specific language governing permissions a
nd limitations under | 11 * or implied. See the License for the specific language governing permissions a
nd limitations under |
12 * the License. | 12 * the License. |
13 */ | 13 */ |
14 package com.google.dart.engine.internal.element; | 14 package com.google.dart.engine.internal.element; |
15 | 15 |
16 import com.google.dart.engine.ast.Identifier; | 16 import com.google.dart.engine.ast.Identifier; |
17 import com.google.dart.engine.context.AnalysisContext; | 17 import com.google.dart.engine.context.AnalysisContext; |
18 import com.google.dart.engine.context.AnalysisException; | 18 import com.google.dart.engine.context.AnalysisException; |
| 19 import com.google.dart.engine.element.ConstructorElement; |
19 import com.google.dart.engine.element.Element; | 20 import com.google.dart.engine.element.Element; |
20 import com.google.dart.engine.element.ElementAnnotation; | 21 import com.google.dart.engine.element.ElementAnnotation; |
21 import com.google.dart.engine.element.ElementLocation; | 22 import com.google.dart.engine.element.ElementLocation; |
22 import com.google.dart.engine.element.ElementVisitor; | 23 import com.google.dart.engine.element.ElementVisitor; |
23 import com.google.dart.engine.element.LibraryElement; | 24 import com.google.dart.engine.element.LibraryElement; |
| 25 import com.google.dart.engine.element.PropertyAccessorElement; |
24 import com.google.dart.engine.source.Source; | 26 import com.google.dart.engine.source.Source; |
25 import com.google.dart.engine.utilities.collection.BooleanArray; | 27 import com.google.dart.engine.utilities.collection.BooleanArray; |
26 import com.google.dart.engine.utilities.general.StringUtilities; | 28 import com.google.dart.engine.utilities.general.StringUtilities; |
27 | 29 |
28 /** | 30 /** |
29 * The abstract class {@code ElementImpl} implements the behavior common to obje
cts that implement | 31 * The abstract class {@code ElementImpl} implements the behavior common to obje
cts that implement |
30 * an {@link Element}. | 32 * an {@link Element}. |
31 * | 33 * |
32 * @coverage dart.engine.element | 34 * @coverage dart.engine.element |
33 */ | 35 */ |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 192 |
191 @Override | 193 @Override |
192 public boolean isAccessibleIn(LibraryElement library) { | 194 public boolean isAccessibleIn(LibraryElement library) { |
193 if (Identifier.isPrivateName(name)) { | 195 if (Identifier.isPrivateName(name)) { |
194 return library.equals(getLibrary()); | 196 return library.equals(getLibrary()); |
195 } | 197 } |
196 return true; | 198 return true; |
197 } | 199 } |
198 | 200 |
199 @Override | 201 @Override |
| 202 public boolean isDeprecated() { |
| 203 for (ElementAnnotation annotation : metadata) { |
| 204 Element element = annotation.getElement(); |
| 205 if (element != null) { |
| 206 LibraryElement lib = element.getLibrary(); |
| 207 if (lib != null && lib.isDartCore()) { |
| 208 if (element instanceof ConstructorElement) { |
| 209 ConstructorElement constructorElement = (ConstructorElement) element
; |
| 210 if (constructorElement.getEnclosingElement().getName().equals("Depre
cated")) { |
| 211 return true; |
| 212 } |
| 213 } else if (element instanceof PropertyAccessorElement |
| 214 && element.getName().equals("deprecated")) { |
| 215 return true; |
| 216 } |
| 217 } |
| 218 } |
| 219 } |
| 220 return false; |
| 221 } |
| 222 |
| 223 @Override |
200 public boolean isSynthetic() { | 224 public boolean isSynthetic() { |
201 return hasModifier(Modifier.SYNTHETIC); | 225 return hasModifier(Modifier.SYNTHETIC); |
202 } | 226 } |
203 | 227 |
204 /** | 228 /** |
205 * Set the metadata associate with this element to the given array of annotati
ons. | 229 * Set the metadata associate with this element to the given array of annotati
ons. |
206 * | 230 * |
207 * @param metadata the metadata to be associated with this element | 231 * @param metadata the metadata to be associated with this element |
208 */ | 232 */ |
209 public void setMetadata(ElementAnnotation[] metadata) { | 233 public void setMetadata(ElementAnnotation[] metadata) { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 * Set whether the given modifier is associated with this element to correspon
d to the given | 340 * Set whether the given modifier is associated with this element to correspon
d to the given |
317 * value. | 341 * value. |
318 * | 342 * |
319 * @param modifier the modifier to be set | 343 * @param modifier the modifier to be set |
320 * @param value {@code true} if the modifier is to be associated with this ele
ment | 344 * @param value {@code true} if the modifier is to be associated with this ele
ment |
321 */ | 345 */ |
322 protected void setModifier(Modifier modifier, boolean value) { | 346 protected void setModifier(Modifier modifier, boolean value) { |
323 modifiers = BooleanArray.set(modifiers, modifier, value); | 347 modifiers = BooleanArray.set(modifiers, modifier, value); |
324 } | 348 } |
325 } | 349 } |
OLD | NEW |