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.common.collect.Lists; | 7 import com.google.common.collect.Lists; |
8 import com.google.dart.compiler.ast.DartClass; | 8 import com.google.dart.compiler.ast.DartClass; |
9 import com.google.dart.compiler.ast.DartDeclaration; | 9 import com.google.dart.compiler.ast.DartDeclaration; |
| 10 import com.google.dart.compiler.ast.DartMetadata; |
10 import com.google.dart.compiler.ast.DartParameterizedTypeNode; | 11 import com.google.dart.compiler.ast.DartParameterizedTypeNode; |
11 import com.google.dart.compiler.ast.DartStringLiteral; | 12 import com.google.dart.compiler.ast.DartStringLiteral; |
12 import com.google.dart.compiler.ast.Modifiers; | 13 import com.google.dart.compiler.ast.Modifiers; |
13 import com.google.dart.compiler.common.SourceInfo; | 14 import com.google.dart.compiler.common.SourceInfo; |
14 import com.google.dart.compiler.type.InterfaceType; | 15 import com.google.dart.compiler.type.InterfaceType; |
15 import com.google.dart.compiler.type.Type; | 16 import com.google.dart.compiler.type.Type; |
16 | 17 |
17 import java.util.ArrayList; | 18 import java.util.ArrayList; |
18 import java.util.HashMap; | 19 import java.util.HashMap; |
19 import java.util.HashSet; | 20 import java.util.HashSet; |
20 import java.util.Iterator; | 21 import java.util.Iterator; |
21 import java.util.List; | 22 import java.util.List; |
22 import java.util.Map; | 23 import java.util.Map; |
23 import java.util.Set; | 24 import java.util.Set; |
24 import java.util.concurrent.atomic.AtomicReference; | 25 import java.util.concurrent.atomic.AtomicReference; |
25 | 26 |
26 class ClassElementImplementation extends AbstractNodeElement implements ClassNod
eElement { | 27 class ClassElementImplementation extends AbstractNodeElement implements ClassNod
eElement { |
27 private InterfaceType type; | 28 private InterfaceType type; |
28 private InterfaceType supertype; | 29 private InterfaceType supertype; |
29 private InterfaceType defaultClass; | 30 private InterfaceType defaultClass; |
30 private final List<InterfaceType> interfaces = Lists.newArrayList(); | 31 private final List<InterfaceType> interfaces = Lists.newArrayList(); |
31 private final boolean isInterface; | 32 private final boolean isInterface; |
32 private final String nativeName; | 33 private final String nativeName; |
| 34 private final DartMetadata metadata; |
33 private final Modifiers modifiers; | 35 private final Modifiers modifiers; |
34 private final AtomicReference<List<InterfaceType>> allSupertypes = | 36 private final AtomicReference<List<InterfaceType>> allSupertypes = |
35 new AtomicReference<List<InterfaceType>>(); | 37 new AtomicReference<List<InterfaceType>>(); |
36 private final SourceInfo nameLocation; | 38 private final SourceInfo nameLocation; |
37 private final String declarationNameWithTypeParameter; | 39 private final String declarationNameWithTypeParameter; |
38 private List<Element> unimplementedMembers; | 40 private List<Element> unimplementedMembers; |
39 | 41 |
40 // declared volatile for thread-safety | 42 // declared volatile for thread-safety |
41 @SuppressWarnings("unused") | 43 @SuppressWarnings("unused") |
42 private volatile Set<InterfaceType> subtypes; | 44 private volatile Set<InterfaceType> subtypes; |
(...skipping 10 matching lines...) Expand all Loading... |
53 } | 55 } |
54 }; | 56 }; |
55 | 57 |
56 ClassElementImplementation(DartClass node, String name, String nativeName, | 58 ClassElementImplementation(DartClass node, String name, String nativeName, |
57 LibraryElement library) { | 59 LibraryElement library) { |
58 super(node, name); | 60 super(node, name); |
59 this.nativeName = nativeName; | 61 this.nativeName = nativeName; |
60 this.library = library; | 62 this.library = library; |
61 if (node != null) { | 63 if (node != null) { |
62 isInterface = node.isInterface(); | 64 isInterface = node.isInterface(); |
| 65 metadata = node.getMetadata(); |
63 modifiers = node.getModifiers(); | 66 modifiers = node.getModifiers(); |
64 nameLocation = node.getName().getSourceInfo(); | 67 nameLocation = node.getName().getSourceInfo(); |
65 declarationNameWithTypeParameter = new DartParameterizedTypeNode(node.getN
ame(), node.getTypeParameters()).toSource(); | 68 declarationNameWithTypeParameter = new DartParameterizedTypeNode(node.getN
ame(), node.getTypeParameters()).toSource(); |
66 } else { | 69 } else { |
67 isInterface = false; | 70 isInterface = false; |
| 71 metadata = DartMetadata.EMPTY; |
68 modifiers = Modifiers.NONE; | 72 modifiers = Modifiers.NONE; |
69 nameLocation = SourceInfo.UNKNOWN; | 73 nameLocation = SourceInfo.UNKNOWN; |
70 declarationNameWithTypeParameter = ""; | 74 declarationNameWithTypeParameter = ""; |
71 } | 75 } |
72 } | 76 } |
73 | 77 |
74 @Override | 78 @Override |
75 public DartDeclaration<?> getNode() { | 79 public DartDeclaration<?> getNode() { |
76 return (DartClass) super.getNode(); | 80 return (DartClass) super.getNode(); |
77 } | 81 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 public ElementKind getKind() { | 154 public ElementKind getKind() { |
151 return ElementKind.CLASS; | 155 return ElementKind.CLASS; |
152 } | 156 } |
153 | 157 |
154 @Override | 158 @Override |
155 public boolean isInterface() { | 159 public boolean isInterface() { |
156 return isInterface; | 160 return isInterface; |
157 } | 161 } |
158 | 162 |
159 @Override | 163 @Override |
| 164 public DartMetadata getMetadata() { |
| 165 return metadata; |
| 166 } |
| 167 |
| 168 @Override |
160 public Modifiers getModifiers() { | 169 public Modifiers getModifiers() { |
161 return modifiers; | 170 return modifiers; |
162 } | 171 } |
163 | 172 |
164 @Override | 173 @Override |
165 public LibraryElement getLibrary() { | 174 public LibraryElement getLibrary() { |
166 return library; | 175 return library; |
167 } | 176 } |
168 | 177 |
169 @Override | 178 @Override |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 @Override | 367 @Override |
359 public List<Element> getUnimplementedMembers() { | 368 public List<Element> getUnimplementedMembers() { |
360 return unimplementedMembers; | 369 return unimplementedMembers; |
361 } | 370 } |
362 | 371 |
363 @Override | 372 @Override |
364 public void setUnimplementedMembers(List<Element> members) { | 373 public void setUnimplementedMembers(List<Element> members) { |
365 this.unimplementedMembers = members; | 374 this.unimplementedMembers = members; |
366 } | 375 } |
367 } | 376 } |
OLD | NEW |