assign method

void assign(
  1. HTStruct other
)

deep copy another struct then assign to this one. existed value with same id in this struct will be overrided

Implementation

void assign(HTStruct other) {
  for (final key in other._fields.keys) {
    if (key.startsWith(interpreter.lexicon.internalPrefix)) continue;
    final value = other._fields[key];
    final copiedValue = interpreter.toStructValue(value);
    define(key, copiedValue, override: true, throws: false);
  }
}