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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 233 |
234 KernelTypeBuilder get mixedInType => null; | 234 KernelTypeBuilder get mixedInType => null; |
235 | 235 |
236 InterfaceType buildType( | 236 InterfaceType buildType( |
237 LibraryBuilder library, List<KernelTypeBuilder> arguments) { | 237 LibraryBuilder library, List<KernelTypeBuilder> arguments) { |
238 return cls.rawType; | 238 return cls.rawType; |
239 } | 239 } |
240 | 240 |
241 @override | 241 @override |
242 Class build(KernelLibraryBuilder libraryBuilder, LibraryBuilder coreLibrary) { | 242 Class build(KernelLibraryBuilder libraryBuilder, LibraryBuilder coreLibrary) { |
| 243 cls.isEnum = true; |
243 if (constantNamesAndOffsets.isEmpty) { | 244 if (constantNamesAndOffsets.isEmpty) { |
244 libraryBuilder.addCompileTimeError( | 245 libraryBuilder.addCompileTimeError( |
245 messageEnumDeclartionEmpty, charOffset, fileUri); | 246 messageEnumDeclartionEmpty, charOffset, fileUri); |
246 } | 247 } |
247 intType.resolveIn(coreLibrary.scope); | 248 intType.resolveIn(coreLibrary.scope); |
248 stringType.resolveIn(coreLibrary.scope); | 249 stringType.resolveIn(coreLibrary.scope); |
249 objectType.resolveIn(coreLibrary.scope); | 250 objectType.resolveIn(coreLibrary.scope); |
250 listType.resolveIn(coreLibrary.scope); | 251 listType.resolveIn(coreLibrary.scope); |
251 toStringMap.keyType = intType.build(libraryBuilder); | 252 toStringMap.keyType = intType.build(libraryBuilder); |
252 toStringMap.valueType = stringType.build(libraryBuilder); | 253 toStringMap.valueType = stringType.build(libraryBuilder); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 } | 307 } |
307 return super.build(libraryBuilder, coreLibrary); | 308 return super.build(libraryBuilder, coreLibrary); |
308 } | 309 } |
309 | 310 |
310 @override | 311 @override |
311 Builder findConstructorOrFactory( | 312 Builder findConstructorOrFactory( |
312 String name, int charOffset, Uri uri, LibraryBuilder library) { | 313 String name, int charOffset, Uri uri, LibraryBuilder library) { |
313 return null; | 314 return null; |
314 } | 315 } |
315 } | 316 } |
OLD | NEW |