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 import java.util.List; |
| 8 |
| 9 |
| 10 /** |
| 11 * Instances of the class {@code DartAnnotation} represent metadata that can be
associated with an |
| 12 * AST node. |
| 13 * |
| 14 * <pre> |
| 15 * metadata ::= |
| 16 * annotation* |
| 17 * |
| 18 * annotation ::= |
| 19 * '@' qualified (‘.’ identifier)? arguments? |
| 20 * </pre> |
| 21 */ |
| 22 public class DartAnnotation extends DartNode { |
| 23 private DartExpression name; |
| 24 |
| 25 private NodeList<DartExpression> arguments = NodeList.create(this); |
| 26 |
| 27 public DartAnnotation(DartExpression name, List<DartExpression> arguments) { |
| 28 this.name = becomeParentOf(name); |
| 29 if (arguments != null) { |
| 30 this.arguments.addAll(arguments); |
| 31 } |
| 32 } |
| 33 |
| 34 @Override |
| 35 public <R> R accept(ASTVisitor<R> visitor) { |
| 36 return visitor.visitAnnotation(this); |
| 37 } |
| 38 |
| 39 public DartExpression getName() { |
| 40 return name; |
| 41 } |
| 42 |
| 43 public NodeList<DartExpression> getArguments() { |
| 44 return arguments; |
| 45 } |
| 46 |
| 47 @Override |
| 48 public void visitChildren(ASTVisitor<?> visitor) { |
| 49 safelyVisitChild(name, visitor); |
| 50 arguments.accept(visitor); |
| 51 } |
| 52 } |
OLD | NEW |