blob: 0c7eadb03e5ee522e3c73439921c2464c1d73d3d [file] [log] [blame]
// Copyright (c) 2023, 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.
import '../ir/ir.dart' as ir;
import 'builder.dart';
/// A global variable defined in a module.
class GlobalBuilder extends ir.Global with IndexableBuilder<ir.DefinedGlobal> {
final InstructionsBuilder initializer;
GlobalBuilder(super.enclosingModule, super.index, super.type,
[super.globalName])
: initializer = InstructionsBuilder(enclosingModule, [], [type.type],
constantExpression: true);
@override
ir.DefinedGlobal forceBuild() => ir.DefinedGlobal(
enclosingModule, initializer.build(), finalizableIndex, type, globalName);
}