visitStructObjField method

  1. @override
Uint8List visitStructObjField(
  1. StructObjField field
)
override

Implementation

@override
Uint8List visitStructObjField(StructObjField field) {
  final bytesBuilder = BytesBuilder();
  if (field.isSpread) {
    bytesBuilder.addByte(1); // bool: has isSpread
    // spread another object
  } else {
    bytesBuilder.addByte(0); // bool: has isSpread
    // normal key: value field
    bytesBuilder.add(_parseIdentifier(field.key!.id));
  }
  final valueBytes = compileAST(field.fieldValue, endOfExec: true);
  bytesBuilder.add(valueBytes);
  return bytesBuilder.toBytes();
}