visitProgramElement method

  1. @override
List<Library> visitProgramElement(
  1. ProgramElement programElement
)
override

Implementation

@override
List<Library> visitProgramElement(ProgramElement programElement) {
  final library = Library((builder) {
    for (final import in programElement.imports) {
      final [element] = import.accept(this) as List<Directive>;
      builder.directives.add(element);
    }

    for (final declaration in programElement.declarations) {
      final elements = declaration.accept(this);
      if (elements != null) {
        builder.body.addAll(elements);
      }
    }
  });

  return [library];
}