declare method

void declare(
  1. int slot,
  2. dynamic value, {
  3. required bool isMutable,
  4. required bool isInitialized,
  5. bool reuseCell = false,
})

Implementation

void declare(
  int slot,
  dynamic value, {
  required bool isMutable,
  required bool isInitialized,
  bool reuseCell = false,
}) {
  _mutable[slot] = isMutable;
  _initialized[slot] = isInitialized;
  if (_hasCapturedSlots && capturedSlots.contains(slot)) {
    final current = slots[slot];
    if (reuseCell && current is HTVariableCell) {
      current.declare(
        value,
        mutable: isMutable,
        initialized: isInitialized,
      );
    } else {
      slots[slot] = HTVariableCell(
        _name(slot),
        value,
        isMutable: isMutable,
        isInitialized: isInitialized,
      );
    }
  } else {
    slots[slot] = value;
  }
}