alias method

void alias(
  1. Unit unit,
  2. String alias
)

Attaches a system-wide alias to this unit.

Multiple aliases may be attached to the same unit. Aliases are used during parsing to recognize different variants of the same unit.

If the specified label is already associated to an unit the previous association is discarded or ignored.

Implementation

void alias(Unit unit, String alias) {
  if (!isValidIdentifier(alias)) {
    throw ArgumentError('Alias: $alias is not a valid identifier.');
  }
  _nameToUnit[alias] = unit;
}