GlobNodeCollection<T extends GlobNode> constructor

GlobNodeCollection<T extends GlobNode>(
  1. String? source,
  2. int? position,
  3. List<T>? nodes
)

Implementation

GlobNodeCollection(String? source, int? position, List<T>? nodes)
    : super(source, position) {
  if (nodes == null) {
    throw ArgumentError.notNull('nodes');
  }

  if (nodes.isEmpty) {
    throw ArgumentError('List of nodes may not be empty');
  }

  for (final node in nodes) {
    if (node is! T) {
      throw ArgumentError('List of nodes contains invalid elements.');
    }
  }

  _nodes = nodes.toList();
}