toBuffer method

AFCodeBuffer toBuffer(
  1. AFCommandContext context, {
  2. Map<AFSourceTemplateInsertion, Object>? insertions,
})

Implementation

AFCodeBuffer toBuffer(AFCommandContext context, { Map<AFSourceTemplateInsertion, Object>? insertions }) {
  var fullInsertions = const AFSourceTemplateInsertions(insertions: <AFSourceTemplateInsertion, Object>{});
  if(insertions != null) {
    fullInsertions = fullInsertions.reviseAugment(insertions);
  }
  final ei = embeddedInsertions;
  if(ei != null) {
    fullInsertions = fullInsertions.reviseAugment(ei.insertions);
  }
  final buffer = AFCodeBuffer.fromTemplate(this);
  if(fullInsertions.isNotEmpty) {
    buffer.performInsertions(context, fullInsertions);
  }
  return buffer;
}