Code.scope constructor

const Code.scope(
  1. String scope(
    1. Allocate
    )
)

Create a code based that may use a provided Allocator for scoping:

// Emits `_i123.FooType()`, where `_i123` is the import prefix.

Code.scope((a) {
  return '${a.allocate(fooType)}()'
});

Implementation

const factory Code.scope(
  String Function(Allocate) scope,
) = ScopedCode._;