memberGet method

  1. @override
dynamic memberGet(
  1. String varName, {
  2. bool isPrivate = false,
  3. String? from,
  4. bool isRecursive = false,
  5. bool throws = true,
})
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.

Implementation

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

  if (throws) {
    throw HTError.undefined(varName);
  }
}