visitStringLiteralExpr method
Implementation
@override
Uint8List visitStringLiteralExpr(ASTLiteralString expr) {
var literal = expr.value;
_lexicon.escapeCharacters.forEach((key, value) {
literal = literal.replaceAll(key, value);
});
if (literal.length > constStringLengthLimit) {
final bytesBuilder = BytesBuilder();
bytesBuilder.addByte(HTOpCode.local);
bytesBuilder.addByte(HTValueTypeCode.string);
bytesBuilder.add(_utf8String(literal));
return bytesBuilder.toBytes();
} else {
final index = _currentConstantTable.addGlobalConstant<String>(literal);
return _localConst(
HTValueTypeCode.constString, index, expr.line, expr.column);
}
}