buildBody method
Builds a parser function body and returns the source code of the function body.
Implementation
@override
BuildBodyResult buildBody(BuildContext context, bool hasResult) {
final ps = _ps;
if (_ps.isEmpty) {
throw ArgumentError.value(_ps, '_ps', 'Must not be empty');
}
ps.take(ps.length - 1).map(checkIsNotOptional);
final template = renderWithPlunge(
ps.length,
hasResult,
last: _templateLast,
lastNoResult: _templateLastNoResult,
next: _templateNext,
nextNoResult: _templateNextNoResult,
fillValues: (index, template, values, next) {
if (index < ps.length - 1) {
values['next'] = next(index + 1);
}
return template;
},
);
return renderBody(
this,
context,
hasResult,
template,
template,
const {},
);
}