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.kernel_enum_builder; | 5 library fasta.kernel_enum_builder; |
6 | 6 |
7 import 'package:kernel/ast.dart' | 7 import 'package:kernel/ast.dart' |
8 show | 8 show |
9 Arguments, | 9 Arguments, |
10 Class, | 10 Class, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 final KernelNamedTypeBuilder intType; | 68 final KernelNamedTypeBuilder intType; |
69 | 69 |
70 final KernelNamedTypeBuilder stringType; | 70 final KernelNamedTypeBuilder stringType; |
71 | 71 |
72 final KernelNamedTypeBuilder objectType; | 72 final KernelNamedTypeBuilder objectType; |
73 | 73 |
74 final KernelNamedTypeBuilder listType; | 74 final KernelNamedTypeBuilder listType; |
75 | 75 |
76 KernelEnumBuilder.internal( | 76 KernelEnumBuilder.internal( |
| 77 String documentationComment, |
77 List<MetadataBuilder> metadata, | 78 List<MetadataBuilder> metadata, |
78 String name, | 79 String name, |
79 Scope scope, | 80 Scope scope, |
80 Scope constructors, | 81 Scope constructors, |
81 Class cls, | 82 Class cls, |
82 this.constantNamesAndOffsets, | 83 this.constantNamesAndOffsets, |
83 this.toStringMap, | 84 this.toStringMap, |
84 this.intType, | 85 this.intType, |
85 this.listType, | 86 this.listType, |
86 this.objectType, | 87 this.objectType, |
87 this.stringType, | 88 this.stringType, |
88 LibraryBuilder parent, | 89 LibraryBuilder parent, |
89 int charOffset) | 90 int charOffset) |
90 : super(metadata, 0, name, null, null, null, scope, constructors, parent, | 91 : super(documentationComment, metadata, 0, name, null, null, null, scope, |
91 null, charOffset, cls); | 92 constructors, parent, null, charOffset, cls); |
92 | 93 |
93 factory KernelEnumBuilder( | 94 factory KernelEnumBuilder( |
94 List<MetadataBuilder> metadata, | 95 List<MetadataBuilder> metadata, |
95 String name, | 96 String name, |
96 List<Object> constantNamesAndOffsets, | 97 List<Object> constantNamesAndOffsets, |
97 KernelLibraryBuilder parent, | 98 KernelLibraryBuilder parent, |
98 int charOffset, | 99 int charOffset, |
99 int charEndOffset) { | 100 int charEndOffset) { |
100 constantNamesAndOffsets ??= const <Object>[]; | 101 constantNamesAndOffsets ??= const <Object>[]; |
101 // TODO(ahe): These types shouldn't be looked up in scope, they come | 102 // TODO(ahe): These types shouldn't be looked up in scope, they come |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 } | 180 } |
180 KernelFieldBuilder fieldBuilder = new KernelFieldBuilder(null, selfType, | 181 KernelFieldBuilder fieldBuilder = new KernelFieldBuilder(null, selfType, |
181 name, constMask | staticMask, parent, charOffset, null, true); | 182 name, constMask | staticMask, parent, charOffset, null, true); |
182 members[name] = fieldBuilder; | 183 members[name] = fieldBuilder; |
183 toStringEntries.add(new MapEntry( | 184 toStringEntries.add(new MapEntry( |
184 new IntLiteral(index), new StringLiteral("$className.$name"))); | 185 new IntLiteral(index), new StringLiteral("$className.$name"))); |
185 index++; | 186 index++; |
186 } | 187 } |
187 MapLiteral toStringMap = new MapLiteral(toStringEntries, isConst: true); | 188 MapLiteral toStringMap = new MapLiteral(toStringEntries, isConst: true); |
188 KernelEnumBuilder enumBuilder = new KernelEnumBuilder.internal( | 189 KernelEnumBuilder enumBuilder = new KernelEnumBuilder.internal( |
| 190 null, |
189 metadata, | 191 metadata, |
190 name, | 192 name, |
191 new Scope(members, null, parent.scope, isModifiable: false), | 193 new Scope(members, null, parent.scope, isModifiable: false), |
192 new Scope(constructors, null, null, isModifiable: false), | 194 new Scope(constructors, null, null, isModifiable: false), |
193 cls, | 195 cls, |
194 constantNamesAndOffsets, | 196 constantNamesAndOffsets, |
195 toStringMap, | 197 toStringMap, |
196 intType, | 198 intType, |
197 listType, | 199 listType, |
198 objectType, | 200 objectType, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 } | 288 } |
287 return super.build(libraryBuilder, coreLibrary); | 289 return super.build(libraryBuilder, coreLibrary); |
288 } | 290 } |
289 | 291 |
290 @override | 292 @override |
291 Builder findConstructorOrFactory( | 293 Builder findConstructorOrFactory( |
292 String name, int charOffset, Uri uri, LibraryBuilder library) { | 294 String name, int charOffset, Uri uri, LibraryBuilder library) { |
293 return null; | 295 return null; |
294 } | 296 } |
295 } | 297 } |
OLD | NEW |