visitSource method

  1. @override
Uint8List visitSource(
  1. ASTSource unit
)
override

Implementation

@override
Uint8List visitSource(ASTSource unit) {
  final bytesBuilder = BytesBuilder();
  bytesBuilder.addByte(HTOpCode.file);
  // if the relativeName is null then it is the entry file of this module.
  bytesBuilder.add(_parseIdentifier(unit.fullName));
  bytesBuilder.addByte(unit.resourceType.index);
  // final convertedNodes = _convertPossibleAwaitedBlockToCallBack(unit.nodes);
  // for (final node in convertedNodes) {
  for (final node in unit.nodes) {
    final bytes = compileAST(node);
    bytesBuilder.add(bytes);
  }
  bytesBuilder.addByte(HTOpCode.endOfFile);

  return bytesBuilder.toBytes();
}