loadCodeUnitAST method

Future<bool> loadCodeUnitAST(
  1. Uint8List image, {
  2. ASTBinaryVerifier? verifier,
  3. String? id,
  4. String? namespace,
})

Decodes a binary AST image and loads it, skipping the parser entirely.

This goes through the ordinary ApolloVM.loadCodeUnit, which only parses when a code unit has no AST yet — so namespace registration, the null-safety check and incremental-resolution invalidation all behave exactly as they do for parsed source.

Pass a verifier to require the image be signed with a key it accepts. Without one, a signed image still loads and its signature is not checked.

Implementation

Future<bool> loadCodeUnitAST(
  Uint8List image, {
  ASTBinaryVerifier? verifier,
  String? id,
  String? namespace,
}) {
  var codeUnit = ASTBinaryReader(
    verifier: verifier,
  ).readCodeUnit(image, id: id, namespace: namespace);

  return loadCodeUnit(codeUnit);
}