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.ast; | 5 package com.google.dart.compiler.ast; |
6 | 6 |
7 /** | 7 /** |
8 * Common supertype for most declarations. A declaration introduces a new name i
n a scope. Certain | 8 * Common supertype for most declarations. A declaration introduces a new name i
n a scope. Certain |
9 * tools, such as the IDE, need to know the location of this name, but the name
should otherwise be | 9 * tools, such as the IDE, need to know the location of this name, but the name
should otherwise be |
10 * considered a part of the declaration, not an independent node. So the name is
not visited when | 10 * considered a part of the declaration, not an independent node. So the name is
not visited when |
11 * traversing the AST. | 11 * traversing the AST. |
12 */ | 12 */ |
13 public abstract class DartDeclaration<N extends DartExpression> extends DartNode
{ | 13 public abstract class DartDeclaration<N extends DartExpression> extends DartNode
WithMetadata { |
14 | 14 |
15 private N name; // Not visited. | 15 private N name; // Not visited. |
16 private DartComment dartDoc; | 16 private DartComment dartDoc; |
17 private DartObsoleteMetadata metadata = DartObsoleteMetadata.EMPTY; | 17 private DartObsoleteMetadata obsoleteMetadata = DartObsoleteMetadata.EMPTY; |
18 | 18 |
19 protected DartDeclaration(N name) { | 19 protected DartDeclaration(N name) { |
20 this.name = becomeParentOf(name); | 20 this.name = becomeParentOf(name); |
21 } | 21 } |
22 | 22 |
23 public final N getName() { | 23 public final N getName() { |
24 return name; | 24 return name; |
25 } | 25 } |
26 | 26 |
27 public final void setName(N newName) { | 27 public final void setName(N newName) { |
28 name = becomeParentOf(newName); | 28 name = becomeParentOf(newName); |
29 } | 29 } |
30 | 30 |
31 public DartComment getDartDoc() { | 31 public DartComment getDartDoc() { |
32 return dartDoc; | 32 return dartDoc; |
33 } | 33 } |
34 | 34 |
35 public void setDartDoc(DartComment dartDoc) { | 35 public void setDartDoc(DartComment dartDoc) { |
36 // dartDoc is still parented by the containing DartUnit. | 36 // dartDoc is still parented by the containing DartUnit. |
37 this.dartDoc = dartDoc; | 37 this.dartDoc = dartDoc; |
38 } | 38 } |
39 | 39 |
40 public DartObsoleteMetadata getMetadata() { | 40 public DartObsoleteMetadata getObsoleteMetadata() { |
41 return metadata; | 41 return obsoleteMetadata; |
42 } | 42 } |
43 | 43 |
44 public void setMetadata(DartObsoleteMetadata metadata) { | 44 public void setObsoleteMetadata(DartObsoleteMetadata metadata) { |
45 this.metadata = metadata; | 45 this.obsoleteMetadata = metadata; |
46 } | 46 } |
47 | 47 |
48 @Override | 48 @Override |
49 public void visitChildren(ASTVisitor<?> visitor) { | 49 public void visitChildren(ASTVisitor<?> visitor) { |
| 50 super.visitChildren(visitor); |
50 safelyVisitChild(name, visitor); | 51 safelyVisitChild(name, visitor); |
51 } | 52 } |
52 } | 53 } |
OLD | NEW |