buildMessage function

ValueNode buildMessage(
  1. ValueNode receiver,
  2. List parts
)

Implementation

ValueNode buildMessage(ValueNode receiver, List parts) {
  return parts
      .where((selectorAndArguments) => selectorAndArguments.isNotEmpty)
      .fold(receiver, (receiver, selectorAndArguments) {
    final message = MessageNode(receiver);
    addTo<Token>(message.selectorToken, selectorAndArguments);
    addTo<ValueNode>(message.arguments, selectorAndArguments);
    return message;
  });
}