blob: 725b34c84f81d85f6f4a3147df0984382eecb127 [file] [log] [blame]
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library fasta.field_builder;
import 'package:kernel/ast.dart';
import 'package:kernel/core_types.dart';
import 'member_builder.dart';
import 'metadata_builder.dart';
import 'type_builder.dart';
abstract class FieldBuilder implements MemberBuilder {
Field get field;
List<MetadataBuilder>? get metadata;
TypeBuilder? get type;
bool get isCovariantByDeclaration;
bool get isLate;
bool get hasInitializer;
/// Whether the body of this field has been built.
///
/// Constant fields have their initializer built in the outline so we avoid
/// building them twice as part of the non-outline build.
bool get hasBodyBeenBuilt;
/// Builds the body of this field using [initializer] as the initializer
/// expression.
void buildBody(CoreTypes coreTypes, Expression? initializer);
/// Builds the field initializers for each field used to encode this field
/// using the [fileOffset] for the created nodes and [value] as the initial
/// field value.
List<Initializer> buildInitializer(int fileOffset, Expression value,
{required bool isSynthetic});
bool get isEligibleForInference;
DartType get builtType;
DartType inferType();
DartType get fieldType;
}