toJSON method

Map<String, dynamic> toJSON()

Implementation

Map<String, dynamic> toJSON() {
  final jsonObject = <String, dynamic>{};

  HTInstanceNamespace? curNamespace = namespace;
  while (curNamespace != null) {
    for (final id in curNamespace.symbols.keys) {
      final decl = curNamespace.symbols[id];
      if (jsonObject.containsKey(id)) {
        continue;
      }
      if (decl is HTDeclaration) {
        jsonObject[id] = decl.value;
      } else {
        jsonObject[id] = decl;
      }
    }
    curNamespace = curNamespace.next;
  }
  return jsonObject;
}