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

Side by Side Diff: compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java

Issue 10703046: Issue 3753. Support for @deprecated annotation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Analyze for @deprecated all invocable elements Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.base.Objects; 8 import com.google.common.base.Objects;
9 import com.google.dart.compiler.DartCompilerContext; 9 import com.google.dart.compiler.DartCompilerContext;
10 import com.google.dart.compiler.ErrorCode; 10 import com.google.dart.compiler.ErrorCode;
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 modifiers = modifiers.makeStatic(); 348 modifiers = modifiers.makeStatic();
349 // Set the "const" modifier so that it is easy to compare a constant fie ld to other 349 // Set the "const" modifier so that it is easy to compare a constant fie ld to other
350 // types of constant expressions. 350 // types of constant expressions.
351 modifiers = modifiers.makeConstant(); 351 modifiers = modifiers.makeConstant();
352 } 352 }
353 if (fieldNode.getValue() != null) { 353 if (fieldNode.getValue() != null) {
354 modifiers = modifiers.makeInitialized(); 354 modifiers = modifiers.makeInitialized();
355 } 355 }
356 FieldNodeElement fieldElement = fieldNode.getElement(); 356 FieldNodeElement fieldElement = fieldNode.getElement();
357 if (fieldElement == null) { 357 if (fieldElement == null) {
358 fieldElement = Elements.fieldFromNode(fieldNode, currentHolder, modifier s); 358 fieldElement = Elements.fieldFromNode(fieldNode, currentHolder, fieldNod e.getMetadata(),
359 modifiers);
359 addField(currentHolder, fieldElement); 360 addField(currentHolder, fieldElement);
360 } else { 361 } else {
361 // This is a top-level element, and an element was already created in 362 // This is a top-level element, and an element was already created in
362 // TopLevelElementBuilder. 363 // TopLevelElementBuilder.
363 Elements.addField(currentHolder, fieldElement); 364 Elements.addField(currentHolder, fieldElement);
364 assertTopLevel(fieldNode); 365 assertTopLevel(fieldNode);
365 } 366 }
366 fieldElement.setType(type); 367 fieldElement.setType(type);
367 recordElement(fieldNode.getName(), fieldElement); 368 recordElement(fieldNode.getName(), fieldElement);
368 return recordElement(fieldNode, fieldElement); 369 return recordElement(fieldNode, fieldElement);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 element = topLevelContext.getScope().findElement(context.getScope().getL ibrary(), name); 432 element = topLevelContext.getScope().findElement(context.getScope().getL ibrary(), name);
432 } 433 }
433 434
434 FieldElementImplementation fieldElement = null; 435 FieldElementImplementation fieldElement = null;
435 if (element == null || element.getKind().equals(ElementKind.FIELD) 436 if (element == null || element.getKind().equals(ElementKind.FIELD)
436 && element.getModifiers().isAbstractField()) { 437 && element.getModifiers().isAbstractField()) {
437 fieldElement = (FieldElementImplementation) element; 438 fieldElement = (FieldElementImplementation) element;
438 } 439 }
439 440
440 if (fieldElement == null) { 441 if (fieldElement == null) {
441 fieldElement = Elements.fieldFromNode(fieldNode, currentHolder, fieldNod e.getModifiers()); 442 fieldElement = Elements.fieldFromNode(fieldNode, currentHolder, fieldNod e.getMetadata(),
443 fieldNode.getModifiers());
442 addField(currentHolder, fieldElement); 444 addField(currentHolder, fieldElement);
443 } 445 }
444 446
445 if (accessorNode.getModifiers().isGetter()) { 447 if (accessorNode.getModifiers().isGetter()) {
446 if (fieldElement.getGetter() != null) { 448 if (fieldElement.getGetter() != null) {
447 if (!topLevelDefinition) { 449 if (!topLevelDefinition) {
448 reportDuplicateDeclaration(ResolverErrorCode.DUPLICATE_MEMBER, field Element.getGetter()); 450 reportDuplicateDeclaration(ResolverErrorCode.DUPLICATE_MEMBER, field Element.getGetter());
449 reportDuplicateDeclaration(ResolverErrorCode.DUPLICATE_MEMBER, acces sorElement); 451 reportDuplicateDeclaration(ResolverErrorCode.DUPLICATE_MEMBER, acces sorElement);
450 } 452 }
451 } else { 453 } else {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 */ 663 */
662 private void reportDuplicateDeclaration(ErrorCode errorCode, Element element ) { 664 private void reportDuplicateDeclaration(ErrorCode errorCode, Element element ) {
663 String name = 665 String name =
664 element instanceof MethodElement 666 element instanceof MethodElement
665 ? Elements.getRawMethodName((MethodElement) element) 667 ? Elements.getRawMethodName((MethodElement) element)
666 : element.getName(); 668 : element.getName();
667 resolutionError(element.getNameLocation(), errorCode, name); 669 resolutionError(element.getNameLocation(), errorCode, name);
668 } 670 }
669 } 671 }
670 } 672 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698