HTExternalInstance<T> constructor

HTExternalInstance<T>(
  1. T externalObject,
  2. HTInterpreter interpreter,
  3. String typeString
)

Create a external class object.

Implementation

HTExternalInstance(
    this.externalObject, HTInterpreter interpreter, this.typeString) {
  this.interpreter = interpreter;
  final id = interpreter.lexicon.getBaseTypeId(typeString);
  if (interpreter.containsExternalClass(id)) {
    externalClass = interpreter.fetchExternalClass(id);
  } else {
    externalClass = null;
  }

  final def = interpreter.currentNamespace
      .memberGet(id, isRecursive: true, throws: false);
  if (def is HTClassDeclaration) {
    klass = def;
  }
  // else if (def is HTExternalEnum) {
  //   enumClass = def;
  // }
  if (klass != null) {
    valueType = HTNominalType(klass!);
  } else {
    valueType = HTExternalType(typeString);
  }
}