addIntlMessage method
Check that the node looks like an Intl.message invocation, and create
the IntlMessage
object from it and store it in messages. Return true
if we successfully extracted a message and should stop looking. Return
false if we didn't, so should continue recursing.
Implementation
bool addIntlMessage(MethodInvocation node) {
if (!looksLikeIntlMessage(node)) return false;
var reason = checkValidity(node) ?? _extractMessage(node);
if (reason != null) {
if (!extraction.suppressWarnings) {
var err = new StringBuffer()
..write("Skipping invalid Intl.message invocation\n <$node>\n")
..writeAll(
[" reason: $reason\n", extraction._reportErrorLocation(node)]);
var errString = err.toString();
extraction.warnings.add(errString);
extraction.onMessage(errString);
}
}
// We found a message, valid or not. Stop recursing.
return true;
}