OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library fasta.kernel_field_builder; |
| 6 |
| 7 import 'package:kernel/ast.dart' show |
| 8 DynamicType, |
| 9 Expression, |
| 10 Field, |
| 11 Library, |
| 12 Name; |
| 13 |
| 14 import 'kernel_builder.dart' show |
| 15 FieldBuilder, |
| 16 KernelTypeBuilder, |
| 17 MetadataBuilder; |
| 18 |
| 19 class KernelFieldBuilder extends FieldBuilder<Expression> { |
| 20 Field field; |
| 21 final List<MetadataBuilder> metadata; |
| 22 final KernelTypeBuilder type; |
| 23 |
| 24 KernelFieldBuilder(this.metadata, this.type, String name, int modifiers) |
| 25 : super(name, modifiers); |
| 26 |
| 27 void set initializer(Expression value) { |
| 28 field.initializer = value |
| 29 ..parent = field; |
| 30 } |
| 31 |
| 32 Field build(Library library) { |
| 33 return field ??= new Field(new Name(name, library), |
| 34 type: type?.build() ?? const DynamicType(), |
| 35 isFinal: isFinal, isConst: isConst, isStatic: isStatic || isTopLevel); |
| 36 } |
| 37 |
| 38 Field get target => field; |
| 39 } |
OLD | NEW |