messageFromDirectPluralOrGenderCall method

MainMessage? messageFromDirectPluralOrGenderCall(
  1. MethodInvocation node
)

Create a MainMessage from node using the name and parameters of the last function/method declaration we encountered and the parameters to the Intl.plural or Intl.gender call.

Implementation

MainMessage? messageFromDirectPluralOrGenderCall(MethodInvocation node) {
  MainMessage extractFromPluralOrGender(MainMessage message, _) {
    var visitor = PluralAndGenderVisitor(
      message.messagePieces,
      message,
      extraction,
    );
    node.accept(visitor);
    return message;
  }

  void setAttribute(MainMessage msg, String fieldName, fieldValue) {
    if (msg.attributeNames.contains(fieldName)) {
      msg[fieldName] = fieldValue;
    }
  }

  return _messageFromNode(node, extractFromPluralOrGender, setAttribute);
}