operator [] method

Message? operator [](
  1. String attributeName
)
override

When we create these from strings or from AST nodes, we want to look up and set their attributes by string names, so we override the indexing operators so that they behave like maps with respect to those attribute names.

Implementation

Message? operator [](String attributeName) {
  var exact = cases[attributeName];
  return exact == null ? cases["other"] : exact;
}