HTStruct constructor

HTStruct(
  1. HTInterpreter interpreter, {
  2. String? id,
  3. HTStruct? prototype,
  4. bool isPrototypeRoot = false,
  5. Map<String, dynamic>? fields,
  6. HTNamespace? closure,
})

Implementation

HTStruct(this.interpreter,
    {String? id,
    this.prototype,
    this.isPrototypeRoot = false,
    Map<String, dynamic>? fields,
    this.closure})
    : id = id ??
          '${InternalIdentifier.anonymousStruct}${structLiteralIndex++}',
      _fields = fields ?? {} {
  namespace = HTNamespace(
      lexicon: interpreter.lexicon, id: this.id, closure: closure);
  namespace.define(
    interpreter.lexicon.kThis,
    HTVariable(
      id: interpreter.lexicon.kThis,
      interpreter: interpreter,
      value: this,
      closure: namespace,
    ),
  );
}