getChild<T> method

  1. @override
ParseTree? getChild<T>(
  1. int i
)
inherited

Implementation

@override
ParseTree? getChild<T>(int i) {
  if (children == null || i < 0 || i >= children!.length) {
    return null;
  }
  if (T == dynamic) {
    return children![i];
  }
  var j = -1; // what element have we found with ctxType?
  for (var o in children!) {
    if (o is T) {
      j++;
      if (j == i) {
        return o;
      }
    }
  }
  return null;
}