OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library fasta.member_builder; | 5 library fasta.member_builder; |
6 | 6 |
7 import 'builder.dart' | 7 import 'builder.dart' |
8 show Builder, ClassBuilder, LibraryBuilder, ModifierBuilder; | 8 show Builder, ClassBuilder, LibraryBuilder, ModifierBuilder; |
9 | 9 |
10 abstract class MemberBuilder extends ModifierBuilder { | 10 abstract class MemberBuilder extends ModifierBuilder { |
11 /// For top-level members, the parent is set correctly during | 11 /// For top-level members, the parent is set correctly during |
12 /// construction. However, for class members, the parent is initially the | 12 /// construction. However, for class members, the parent is initially the |
13 /// library and updated later. | 13 /// library and updated later. |
14 Builder parent; | 14 Builder parent; |
15 | 15 |
| 16 String documentationComment; |
| 17 |
16 String get name; | 18 String get name; |
17 | 19 |
18 MemberBuilder(Builder parent, int charOffset) | 20 MemberBuilder(Builder parent, int charOffset, this.documentationComment) |
19 : parent = parent, | 21 : parent = parent, |
20 super(parent, charOffset); | 22 super(parent, charOffset); |
21 | 23 |
22 bool get isInstanceMember => isClassMember && !isStatic; | 24 bool get isInstanceMember => isClassMember && !isStatic; |
23 | 25 |
24 bool get isClassMember => parent is ClassBuilder; | 26 bool get isClassMember => parent is ClassBuilder; |
25 | 27 |
26 bool get isTopLevel => !isClassMember; | 28 bool get isTopLevel => !isClassMember; |
27 | 29 |
28 bool get isNative => false; | 30 bool get isNative => false; |
29 | 31 |
30 bool get isRedirectingGenerativeConstructor => false; | 32 bool get isRedirectingGenerativeConstructor => false; |
31 | 33 |
32 LibraryBuilder get library { | 34 LibraryBuilder get library { |
33 if (parent is LibraryBuilder) { | 35 if (parent is LibraryBuilder) { |
34 LibraryBuilder library = parent; | 36 LibraryBuilder library = parent; |
35 return library.partOfLibrary ?? library; | 37 return library.partOfLibrary ?? library; |
36 } else { | 38 } else { |
37 ClassBuilder cls = parent; | 39 ClassBuilder cls = parent; |
38 return cls.library; | 40 return cls.library; |
39 } | 41 } |
40 } | 42 } |
41 | 43 |
42 @override | 44 @override |
43 String get fullNameForErrors => name; | 45 String get fullNameForErrors => name; |
44 } | 46 } |
OLD | NEW |