visitStringInterpolationExpr method

  1. @override
Uint8List visitStringInterpolationExpr(
  1. ASTStringInterpolation expr
)
override

Implementation

@override
Uint8List visitStringInterpolationExpr(ASTStringInterpolation expr) {
  final bytesBuilder = BytesBuilder();
  bytesBuilder.addByte(HTOpCode.local);
  bytesBuilder.addByte(HTValueTypeCode.stringInterpolation);
  var literal = expr.text;
  _lexicon.escapeCharacters.forEach((key, value) {
    literal = literal.replaceAll(key, value);
  });
  bytesBuilder.add(_utf8String(literal));
  bytesBuilder.addByte(expr.interpolations.length);
  for (final node in expr.interpolations) {
    final bytes = compileAST(node, endOfExec: true);
    bytesBuilder.add(bytes);
  }
  return bytesBuilder.toBytes();
}