| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 package com.google.dart.compiler.ast; | |
| 6 | |
| 7 /** | |
| 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 | |
| 10 * considered a part of the declaration, not an independent node. So the name is
not visited when | |
| 11 * traversing the AST. | |
| 12 */ | |
| 13 public abstract class DartDeclaration<N extends DartExpression> extends DartNode
WithMetadata | |
| 14 implements HasObsoleteMetadata { | |
| 15 | |
| 16 private N name; // Not visited. | |
| 17 private DartComment dartDoc; | |
| 18 private DartObsoleteMetadata obsoleteMetadata = DartObsoleteMetadata.EMPTY; | |
| 19 | |
| 20 protected DartDeclaration(N name) { | |
| 21 this.name = becomeParentOf(name); | |
| 22 } | |
| 23 | |
| 24 public final N getName() { | |
| 25 return name; | |
| 26 } | |
| 27 | |
| 28 public final void setName(N newName) { | |
| 29 name = becomeParentOf(newName); | |
| 30 } | |
| 31 | |
| 32 public DartComment getDartDoc() { | |
| 33 return dartDoc; | |
| 34 } | |
| 35 | |
| 36 public void setDartDoc(DartComment dartDoc) { | |
| 37 // dartDoc is still parented by the containing DartUnit. | |
| 38 this.dartDoc = dartDoc; | |
| 39 } | |
| 40 | |
| 41 public DartObsoleteMetadata getObsoleteMetadata() { | |
| 42 return obsoleteMetadata; | |
| 43 } | |
| 44 | |
| 45 public void setObsoleteMetadata(DartObsoleteMetadata metadata) { | |
| 46 this.obsoleteMetadata = metadata; | |
| 47 } | |
| 48 | |
| 49 @Override | |
| 50 public void visitChildren(ASTVisitor<?> visitor) { | |
| 51 safelyVisitChild(dartDoc, visitor); | |
| 52 super.visitChildren(visitor); | |
| 53 safelyVisitChild(name, visitor); | |
| 54 } | |
| 55 } | |
| OLD | NEW |