createImport method

VFunction createImport()

Create a Function with the code we have parsed, for use as an import. That means, it runs all that code, then at the end it returns locals so that the caller can get its symbols.

Implementation

VFunction createImport() {
  // Add one additional line to return `locals` as the function return value.
  final locals = ValVar('locals');
  output!.add(tac.Line(tac.lTemp(0), tac.LineOp.returnA, locals));
  // Then wrap the whole thing in a Function.
  return VFunction(output!.code);
}