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 | |
18 String get name; | 16 String get name; |
19 | 17 |
20 MemberBuilder(Builder parent, int charOffset, this.documentationComment) | 18 MemberBuilder(Builder parent, int charOffset) |
21 : parent = parent, | 19 : parent = parent, |
22 super(parent, charOffset); | 20 super(parent, charOffset); |
23 | 21 |
24 bool get isInstanceMember => isClassMember && !isStatic; | 22 bool get isInstanceMember => isClassMember && !isStatic; |
25 | 23 |
26 bool get isClassMember => parent is ClassBuilder; | 24 bool get isClassMember => parent is ClassBuilder; |
27 | 25 |
28 bool get isTopLevel => !isClassMember; | 26 bool get isTopLevel => !isClassMember; |
29 | 27 |
30 bool get isNative => false; | 28 bool get isNative => false; |
31 | 29 |
32 bool get isRedirectingGenerativeConstructor => false; | 30 bool get isRedirectingGenerativeConstructor => false; |
33 | 31 |
34 LibraryBuilder get library { | 32 LibraryBuilder get library { |
35 if (parent is LibraryBuilder) { | 33 if (parent is LibraryBuilder) { |
36 LibraryBuilder library = parent; | 34 LibraryBuilder library = parent; |
37 return library.partOfLibrary ?? library; | 35 return library.partOfLibrary ?? library; |
38 } else { | 36 } else { |
39 ClassBuilder cls = parent; | 37 ClassBuilder cls = parent; |
40 return cls.library; | 38 return cls.library; |
41 } | 39 } |
42 } | 40 } |
43 | 41 |
44 @override | 42 @override |
45 String get fullNameForErrors => name; | 43 String get fullNameForErrors => name; |
46 } | 44 } |
OLD | NEW |