memberGet method

  1. @override
dynamic memberGet(
  1. String varName, {
  2. String? from,
})
override

Fetch a member by the varName, in the form of

object.varName

varName must be of String type.

Implementation

@override
dynamic memberGet(String varName, {String? from}) {
  if (externalClass != null) {
    final member = externalClass!.instanceMemberGet(externalObject, varName);
    if (member is Function && klass != null) {
      HTClass? currentKlass = klass! as HTClass;
      HTFunction? decl;
      while (decl == null && currentKlass != null) {
        decl = currentKlass.memberGet(varName, throws: false);
        currentKlass = currentKlass.superClass;
      }
      if (decl != null) {
        // Assign the value as if we are doing decl.resolve() here.
        decl.externalFunc = member;
        return decl;
      }
    } else {
      return member;
    }
  }
  throw HTError.undefined(varName);
}