operator [] method

dynamic operator [](
  1. int index
)

Implementation

dynamic operator [](int index) {
  switch (index) {
    case 0:
      return this.$1;
    case 1:
      return this.$2;
    default:
      throw RangeError("Invalid index $index for a record of length 2.");
  }
}