clone method

HTStruct clone()

Implementation

HTStruct clone() {
  final cloned =
      HTStruct(interpreter, prototype: prototype, closure: closure);
  for (final key in _fields.keys) {
    final value = _fields[key];
    final copiedValue = interpreter.toStructValue(value);
    cloned.define(key, copiedValue);
  }
  return cloned;
}