memberGet method

  1. @override
dynamic memberGet(
  1. String id, {
  2. String? from,
  3. bool isRecursive = false,
  4. bool ignoreUndefined = false,
  5. bool isPrivate = false,
})
override

Fetch a value from this namespace, Return declaration rather than actual values. If not found and isRecursive is true, will continue search in super namespaces. If isRecursive is true, means this is not a 'memberget operator' search.

TODO: remove isPrivate check;

Implementation

@override
dynamic memberGet(
  String id, {
  String? from,
  bool isRecursive = false,
  bool ignoreUndefined = false,
  bool isPrivate = false,
}) {
  if (symbols.containsKey(id)) {
    final decl = symbols[id];
    if (isPrivate && from != null && !from.startsWith(fullName)) {
      throw HTError.privateMember(id);
    }
    return decl;
  } else if (importedSymbols.containsKey(id)) {
    final decl = importedSymbols[id];
    return decl;
  } else if (isRecursive && (closure != null)) {
    return closure!.memberGet(id, from: from, isRecursive: true);
  }

  if (!ignoreUndefined) {
    throw HTError.undefined(id);
  }
}