ancestor method

Environment ancestor(
  1. int distance
)

Implementation

Environment ancestor(int distance) {
  Environment environment = this;
  for (int i = 0; i < distance; i++) {
    environment = environment.enclosing!;
  }
  return environment;
}