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.source_class_builder; | 5 library fasta.source_class_builder; |
6 | 6 |
7 import 'package:kernel/ast.dart' | 7 import 'package:kernel/ast.dart' |
8 show Class, Constructor, Supertype, TreeNode, setParents; | 8 show Class, Constructor, Supertype, TreeNode, setParents; |
9 | 9 |
10 import '../dill/dill_member_builder.dart' show DillMemberBuilder; | 10 import '../dill/dill_member_builder.dart' show DillMemberBuilder; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 cls ??= new Class(name: name); | 42 cls ??= new Class(name: name); |
43 cls.fileUri ??= parent.library.fileUri; | 43 cls.fileUri ??= parent.library.fileUri; |
44 if (cls.fileOffset == TreeNode.noOffset) { | 44 if (cls.fileOffset == TreeNode.noOffset) { |
45 cls.fileOffset = charOffset; | 45 cls.fileOffset = charOffset; |
46 } | 46 } |
47 return cls; | 47 return cls; |
48 } | 48 } |
49 | 49 |
50 class SourceClassBuilder extends KernelClassBuilder { | 50 class SourceClassBuilder extends KernelClassBuilder { |
51 final Class cls; | 51 final Class cls; |
| 52 final String documentationComment; |
52 | 53 |
53 final List<ConstructorReferenceBuilder> constructorReferences; | 54 final List<ConstructorReferenceBuilder> constructorReferences; |
54 | 55 |
55 KernelTypeBuilder mixedInType; | 56 KernelTypeBuilder mixedInType; |
56 | 57 |
57 SourceClassBuilder( | 58 SourceClassBuilder( |
| 59 this.documentationComment, |
58 List<MetadataBuilder> metadata, | 60 List<MetadataBuilder> metadata, |
59 int modifiers, | 61 int modifiers, |
60 String name, | 62 String name, |
61 List<TypeVariableBuilder> typeVariables, | 63 List<TypeVariableBuilder> typeVariables, |
62 KernelTypeBuilder supertype, | 64 KernelTypeBuilder supertype, |
63 List<KernelTypeBuilder> interfaces, | 65 List<KernelTypeBuilder> interfaces, |
64 Scope scope, | 66 Scope scope, |
65 Scope constructors, | 67 Scope constructors, |
66 LibraryBuilder parent, | 68 LibraryBuilder parent, |
67 this.constructorReferences, | 69 this.constructorReferences, |
(...skipping 11 matching lines...) Expand all Loading... |
79 for (KernelTypeVariableBuilder t in typeVariables) { | 81 for (KernelTypeVariableBuilder t in typeVariables) { |
80 cls.typeParameters.add(t.parameter); | 82 cls.typeParameters.add(t.parameter); |
81 } | 83 } |
82 setParents(cls.typeParameters, cls); | 84 setParents(cls.typeParameters, cls); |
83 count += cls.typeParameters.length; | 85 count += cls.typeParameters.length; |
84 } | 86 } |
85 return count + super.resolveTypes(library); | 87 return count + super.resolveTypes(library); |
86 } | 88 } |
87 | 89 |
88 Class build(KernelLibraryBuilder library, LibraryBuilder coreLibrary) { | 90 Class build(KernelLibraryBuilder library, LibraryBuilder coreLibrary) { |
| 91 cls.documentationComment = documentationComment; |
| 92 |
89 void buildBuilders(String name, Builder builder) { | 93 void buildBuilders(String name, Builder builder) { |
90 do { | 94 do { |
91 if (builder is KernelFieldBuilder) { | 95 if (builder is KernelFieldBuilder) { |
92 // TODO(ahe): It would be nice to have a common interface for the | 96 // TODO(ahe): It would be nice to have a common interface for the |
93 // build method to avoid duplicating these two cases. | 97 // build method to avoid duplicating these two cases. |
94 cls.addMember(builder.build(library)); | 98 cls.addMember(builder.build(library)); |
95 } else if (builder is KernelFunctionBuilder) { | 99 } else if (builder is KernelFunctionBuilder) { |
96 cls.addMember(builder.build(library)); | 100 cls.addMember(builder.build(library)); |
97 } else { | 101 } else { |
98 unhandled("${builder.runtimeType}", "buildBuilders", | 102 unhandled("${builder.runtimeType}", "buildBuilders", |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 168 } |
165 | 169 |
166 @override | 170 @override |
167 void prepareInitializerInference( | 171 void prepareInitializerInference( |
168 SourceLibraryBuilder library, ClassBuilder currentClass) { | 172 SourceLibraryBuilder library, ClassBuilder currentClass) { |
169 scope.forEach((name, builder) { | 173 scope.forEach((name, builder) { |
170 builder.prepareInitializerInference(library, this); | 174 builder.prepareInitializerInference(library, this); |
171 }); | 175 }); |
172 } | 176 } |
173 } | 177 } |
OLD | NEW |