buildBody method

  1. @override
BuildBodyResult buildBody(
  1. BuildContext context,
  2. bool hasResult
)
override

Builds a parser function body and returns the source code of the function body.

Implementation

@override
BuildBodyResult buildBody(BuildContext context, bool hasResult) {
  final cache = context
      .initializeCache('parser_builder_lite.memoize', <Object?, int>{});
  var id = 0;
  if (cache.containsKey(p)) {
    id = cache[p]!;
  } else {
    id = cache.length;
    cache[p] = id;
  }

  return renderBody(
    this,
    context,
    hasResult,
    _template,
    _templateNoResult,
    {'id': getAsCode(id), 'O': getResultType()},
  );
}