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.resolver; | 5 package com.google.dart.compiler.resolver; |
6 | 6 |
7 import com.google.dart.compiler.ast.DartField; | 7 import com.google.dart.compiler.ast.DartField; |
8 import com.google.dart.compiler.ast.DartIdentifier; | 8 import com.google.dart.compiler.ast.DartMetadata; |
9 import com.google.dart.compiler.ast.DartMethodDefinition; | |
10 import com.google.dart.compiler.ast.DartNode; | 9 import com.google.dart.compiler.ast.DartNode; |
11 import com.google.dart.compiler.ast.Modifiers; | 10 import com.google.dart.compiler.ast.Modifiers; |
12 import com.google.dart.compiler.common.SourceInfo; | 11 import com.google.dart.compiler.common.SourceInfo; |
13 import com.google.dart.compiler.type.Type; | 12 import com.google.dart.compiler.type.Type; |
14 | 13 |
15 class FieldElementImplementation extends AbstractNodeElement implements FieldEle
ment, FieldNodeElement { | 14 class FieldElementImplementation extends AbstractNodeElement implements FieldEle
ment, FieldNodeElement { |
16 private final EnclosingElement holder; | 15 private final EnclosingElement holder; |
17 private final SourceInfo nameLocation; | 16 private final SourceInfo nameLocation; |
| 17 private DartMetadata metadata; |
18 private Modifiers modifiers; | 18 private Modifiers modifiers; |
19 private Type type; | 19 private Type type; |
20 private MethodNodeElement getter; | 20 private MethodNodeElement getter; |
21 private MethodNodeElement setter; | 21 private MethodNodeElement setter; |
22 private Type constantType; | 22 private Type constantType; |
23 | 23 |
24 FieldElementImplementation(DartNode node, | 24 FieldElementImplementation(DartNode node, |
25 SourceInfo nameLocation, | 25 SourceInfo nameLocation, |
26 String name, | 26 String name, |
27 EnclosingElement holder, | 27 EnclosingElement holder, |
| 28 DartMetadata metadata, |
28 Modifiers modifiers) { | 29 Modifiers modifiers) { |
29 super(node, name); | 30 super(node, name); |
30 this.holder = holder; | 31 this.holder = holder; |
| 32 this.metadata = metadata; |
31 this.modifiers = modifiers; | 33 this.modifiers = modifiers; |
32 this.nameLocation = nameLocation; | 34 this.nameLocation = nameLocation; |
33 } | 35 } |
34 | 36 |
35 @Override | 37 @Override |
36 public Type getType() { | 38 public Type getType() { |
37 return type; | 39 return type; |
38 } | 40 } |
39 | 41 |
40 @Override | 42 @Override |
(...skipping 10 matching lines...) Expand all Loading... |
51 public SourceInfo getNameLocation() { | 53 public SourceInfo getNameLocation() { |
52 return nameLocation; | 54 return nameLocation; |
53 } | 55 } |
54 | 56 |
55 @Override | 57 @Override |
56 public EnclosingElement getEnclosingElement() { | 58 public EnclosingElement getEnclosingElement() { |
57 return holder; | 59 return holder; |
58 } | 60 } |
59 | 61 |
60 @Override | 62 @Override |
| 63 public DartMetadata getMetadata() { |
| 64 return metadata; |
| 65 } |
| 66 |
| 67 @Override |
61 public Modifiers getModifiers() { | 68 public Modifiers getModifiers() { |
62 return modifiers; | 69 return modifiers; |
63 } | 70 } |
64 | 71 |
65 @Override | 72 @Override |
66 public boolean isStatic() { | 73 public boolean isStatic() { |
67 return modifiers.isStatic(); | 74 return modifiers.isStatic(); |
68 } | 75 } |
69 | 76 |
70 public static FieldElementImplementation fromNode(DartField node, | 77 public static FieldElementImplementation fromNode(DartField node, |
71 EnclosingElement holder, | 78 EnclosingElement holder, |
| 79 DartMetadata metadata, |
72 Modifiers modifiers) { | 80 Modifiers modifiers) { |
73 return new FieldElementImplementation(node, | 81 return new FieldElementImplementation(node, |
74 node.getName().getSourceInfo(), | 82 node.getName().getSourceInfo(), |
75 node.getName().getName(), | 83 node.getName().getName(), |
76 holder, | 84 holder, |
| 85 metadata, |
77 modifiers); | 86 modifiers); |
78 } | 87 } |
79 | 88 |
80 public static FieldElementImplementation fromNode(DartMethodDefinition node, | |
81 EnclosingElement holder, | |
82 Modifiers modifiers) { | |
83 return new FieldElementImplementation(node, | |
84 node.getName().getSourceInfo(), | |
85 ((DartIdentifier) node.getName()).getName(), | |
86 holder, | |
87 modifiers); | |
88 } | |
89 | |
90 @Override | 89 @Override |
91 public MethodNodeElement getGetter() { | 90 public MethodNodeElement getGetter() { |
92 return getter; | 91 return getter; |
93 } | 92 } |
94 | 93 |
95 @Override | 94 @Override |
96 public MethodNodeElement getSetter() { | 95 public MethodNodeElement getSetter() { |
97 return setter; | 96 return setter; |
98 } | 97 } |
99 | 98 |
100 void setGetter(MethodNodeElement getter) { | 99 void setGetter(MethodNodeElement getter) { |
101 this.getter = getter; | 100 this.getter = getter; |
102 } | 101 } |
103 | 102 |
104 void setSetter(MethodNodeElement setter) { | 103 void setSetter(MethodNodeElement setter) { |
105 this.setter = setter; | 104 this.setter = setter; |
106 } | 105 } |
107 | 106 |
108 @Override | 107 @Override |
109 public Type getConstantType() { | 108 public Type getConstantType() { |
110 return constantType; | 109 return constantType; |
111 } | 110 } |
112 | 111 |
113 @Override | 112 @Override |
114 public void setConstantType(Type type) { | 113 public void setConstantType(Type type) { |
115 constantType = type; | 114 constantType = type; |
116 } | 115 } |
117 } | 116 } |
OLD | NEW |