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

Side by Side Diff: compiler/java/com/google/dart/compiler/ast/DartAnnotation.java

Issue 10860012: Add support for metadata annotation syntax (issue 4056) (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698