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

Side by Side Diff: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java

Issue 10661022: Issue 3752. Support for @override annotations (as structured doc comments) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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.type; 5 package com.google.dart.compiler.type;
6 6
7 import com.google.common.annotations.VisibleForTesting; 7 import com.google.common.annotations.VisibleForTesting;
8 import com.google.common.base.Joiner; 8 import com.google.common.base.Joiner;
9 import com.google.common.base.Objects; 9 import com.google.common.base.Objects;
10 import com.google.common.collect.ArrayListMultimap; 10 import com.google.common.collect.ArrayListMultimap;
(...skipping 2667 matching lines...) Expand 10 before | Expand all | Expand 10 after
2678 } 2678 }
2679 return null; 2679 return null;
2680 } 2680 }
2681 2681
2682 @Override 2682 @Override
2683 public Void visitMethodDefinition(DartMethodDefinition node) { 2683 public Void visitMethodDefinition(DartMethodDefinition node) {
2684 MethodElement method = node.getElement(); 2684 MethodElement method = node.getElement();
2685 String name = method.getName(); 2685 String name = method.getName();
2686 if (superMembers != null && !method.isConstructor()) { 2686 if (superMembers != null && !method.isConstructor()) {
2687 Collection<Element> overridden = superMembers.removeAll(name); 2687 Collection<Element> overridden = superMembers.removeAll(name);
2688 // Check for invalid @override metadata.
2689 if (overridden.isEmpty() && node.getMetadata().isOverride()) {
Brian Wilkerson 2012/06/25 14:24:38 Is there any demand for the inverse (warning for a
scheglov 2012/06/26 19:46:34 This would add a lot of warnings into existing pro
2690 typeError(node.getName(), ResolverErrorCode.INVALID_OVERRIDE_METADAT A);
2691 }
2692 // Check that override is valid.
2688 for (Element element : overridden) { 2693 for (Element element : overridden) {
2689 if (canOverride(node.getName(), method.getModifiers(), element)) { 2694 if (canOverride(node.getName(), method.getModifiers(), element)) {
2690 switch (element.getKind()) { 2695 switch (element.getKind()) {
2691 case METHOD: 2696 case METHOD:
2692 checkOverride(node.getName(), method, element); 2697 checkOverride(node.getName(), method, element);
2693 break; 2698 break;
2694 2699
2695 case FIELD: 2700 case FIELD:
2696 typeError(node.getName(), TypeErrorCode.SUPERTYPE_HAS_FIELD, e lement.getName(), 2701 typeError(node.getName(), TypeErrorCode.SUPERTYPE_HAS_FIELD, e lement.getName(),
2697 element.getEnclosingElement().getName()); 2702 element.getEnclosingElement().getName());
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2817 for (VariableElement v : parameters) { 2822 for (VariableElement v : parameters) {
2818 if (v.isNamed()) { 2823 if (v.isNamed()) {
2819 named.add(v); 2824 named.add(v);
2820 } 2825 }
2821 } 2826 }
2822 return named; 2827 return named;
2823 } 2828 }
2824 } 2829 }
2825 } 2830 }
2826 } 2831 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698