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

Side by Side Diff: compiler/java/com/google/dart/compiler/resolver/MethodElementImplementation.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.collect.ImmutableSet; 8 import com.google.common.collect.ImmutableSet;
9 import com.google.dart.compiler.ast.DartBlock; 9 import com.google.dart.compiler.ast.DartBlock;
10 import com.google.dart.compiler.ast.DartClass; 10 import com.google.dart.compiler.ast.DartClass;
11 import com.google.dart.compiler.ast.DartFunctionExpression; 11 import com.google.dart.compiler.ast.DartFunctionExpression;
12 import com.google.dart.compiler.ast.DartIdentifier; 12 import com.google.dart.compiler.ast.DartIdentifier;
13 import com.google.dart.compiler.ast.DartMetadata;
13 import com.google.dart.compiler.ast.DartMethodDefinition; 14 import com.google.dart.compiler.ast.DartMethodDefinition;
14 import com.google.dart.compiler.ast.DartNativeBlock; 15 import com.google.dart.compiler.ast.DartNativeBlock;
15 import com.google.dart.compiler.ast.DartNode; 16 import com.google.dart.compiler.ast.DartNode;
16 import com.google.dart.compiler.ast.Modifiers; 17 import com.google.dart.compiler.ast.Modifiers;
17 import com.google.dart.compiler.common.SourceInfo; 18 import com.google.dart.compiler.common.SourceInfo;
18 import com.google.dart.compiler.type.FunctionType; 19 import com.google.dart.compiler.type.FunctionType;
19 import com.google.dart.compiler.type.Type; 20 import com.google.dart.compiler.type.Type;
20 21
21 import java.util.ArrayList; 22 import java.util.ArrayList;
22 import java.util.Collections; 23 import java.util.Collections;
23 import java.util.List; 24 import java.util.List;
24 import java.util.Set; 25 import java.util.Set;
25 26
26 class MethodElementImplementation extends AbstractNodeElement implements MethodN odeElement { 27 class MethodElementImplementation extends AbstractNodeElement implements MethodN odeElement {
28 private final DartMetadata metadata;
27 private final Modifiers modifiers; 29 private final Modifiers modifiers;
28 private final EnclosingElement holder; 30 private final EnclosingElement holder;
29 private final ElementKind kind; 31 private final ElementKind kind;
30 private final List<VariableElement> parameters = new ArrayList<VariableElement >(); 32 private final List<VariableElement> parameters = new ArrayList<VariableElement >();
31 private FunctionType type; 33 private FunctionType type;
32 private final SourceInfo nameLocation; 34 private final SourceInfo nameLocation;
33 private final boolean hasBody; 35 private final boolean hasBody;
34 private Set<Element> overridden = ImmutableSet.of(); 36 private Set<Element> overridden = ImmutableSet.of();
35 37
36 // TODO(ngeoffray): name, return type, argument types. 38 // TODO(ngeoffray): name, return type, argument types.
37 @VisibleForTesting 39 @VisibleForTesting
38 MethodElementImplementation(DartFunctionExpression node, String name, Modifier s modifiers) { 40 MethodElementImplementation(DartFunctionExpression node, String name, Modifier s modifiers) {
39 super(node, name); 41 super(node, name);
42 this.metadata = DartMetadata.EMPTY;
43 this.modifiers = modifiers;
40 this.hasBody = true; 44 this.hasBody = true;
41 this.modifiers = modifiers;
42 this.holder = findParentEnclosingElement(node); 45 this.holder = findParentEnclosingElement(node);
43 this.kind = ElementKind.FUNCTION_OBJECT; 46 this.kind = ElementKind.FUNCTION_OBJECT;
44 if (node != null && node.getName() != null) { 47 if (node != null && node.getName() != null) {
45 this.nameLocation = node.getName().getSourceInfo(); 48 this.nameLocation = node.getName().getSourceInfo();
46 } else { 49 } else {
47 this.nameLocation = SourceInfo.UNKNOWN; 50 this.nameLocation = SourceInfo.UNKNOWN;
48 } 51 }
49 } 52 }
50 53
51 protected MethodElementImplementation(DartMethodDefinition node, String name, 54 protected MethodElementImplementation(DartMethodDefinition node, String name,
52 EnclosingElement holder) { 55 EnclosingElement holder) {
53 super(node, name); 56 super(node, name);
54 if (node != null) { 57 if (node != null) {
58 this.metadata = node.getMetadata();
55 this.modifiers = node.getModifiers(); 59 this.modifiers = node.getModifiers();
56 this.nameLocation = node.getName().getSourceInfo(); 60 this.nameLocation = node.getName().getSourceInfo();
57 DartBlock body = node.getFunction().getBody(); 61 DartBlock body = node.getFunction().getBody();
58 this.hasBody = body != null && !(body instanceof DartNativeBlock); 62 this.hasBody = body != null && !(body instanceof DartNativeBlock);
59 } else { 63 } else {
64 this.metadata = DartMetadata.EMPTY;
60 this.modifiers = Modifiers.NONE; 65 this.modifiers = Modifiers.NONE;
61 this.nameLocation = SourceInfo.UNKNOWN; 66 this.nameLocation = SourceInfo.UNKNOWN;
62 this.hasBody = false; 67 this.hasBody = false;
63 } 68 }
64 this.holder = holder; 69 this.holder = holder;
65 this.kind = ElementKind.METHOD; 70 this.kind = ElementKind.METHOD;
66 } 71 }
67 72
68 @Override 73 @Override
74 public DartMetadata getMetadata() {
75 return metadata;
76 }
77
78 @Override
69 public Modifiers getModifiers() { 79 public Modifiers getModifiers() {
70 return modifiers; 80 return modifiers;
71 } 81 }
72 82
73 @Override 83 @Override
74 public ElementKind getKind() { 84 public ElementKind getKind() {
75 return kind; 85 return kind;
76 } 86 }
77 87
78 @Override 88 @Override
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 188 }
179 189
180 public void setOverridden(Set<Element> overridden) { 190 public void setOverridden(Set<Element> overridden) {
181 this.overridden = overridden; 191 this.overridden = overridden;
182 } 192 }
183 193
184 public Set<Element> getOverridden() { 194 public Set<Element> getOverridden() {
185 return overridden; 195 return overridden;
186 } 196 }
187 } 197 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698