help method

String help({
  1. bool displayNamespaceName = true,
})

Implementation

String help({bool displayNamespaceName = true}) {
  final buffer = StringBuffer();
  final id = displayNamespaceName ? fullName : '';
  if (symbols.isNotEmpty || importedSymbols.isNotEmpty) {
    buffer.writeln('namespace $id {');
    for (final decl in symbols.values) {
      if (decl is HTFunction) {
        buffer.writeln('  ${decl.internalName}');
      } else {
        buffer.writeln('  ${decl.id}');
      }
    }
    for (final decl in importedSymbols.values) {
      if (decl is HTFunction) {
        buffer.writeln('  ${decl.internalName}');
      } else {
        buffer.writeln('  ${decl.id}');
      }
    }
    buffer.writeln('}');
  } else {
    buffer.writeln('namespace $id {}');
  }
  return buffer.toString();
}