visitStringLiteral method
Category fallback for string literals.
Implementation
@override
Object? visitStringLiteral(SAstNode node) {
if (node is SSimpleStringLiteral) {
return node.value;
} else if (node is SAdjacentStrings) {
// Handle adjacent strings like 'Hello ' 'World!'
final buffer = StringBuffer();
for (final stringLiteral in node.strings) {
if (stringLiteral is SSimpleStringLiteral) {
buffer.write(stringLiteral.value);
} else if (stringLiteral is SStringInterpolation) {
// G-DOV-1/2 FIX: Handle SStringInterpolation children within SAdjacentStrings
buffer.write(visitStringInterpolation(stringLiteral));
} else {
// Recursively handle nested adjacent strings or other string types
final value = visitStringLiteral(stringLiteral);
buffer.write(value.toString());
}
}
return buffer.toString();
}
throw UnimplementedD4rtException(
'Type de StringLiteral non géré: ${node.runtimeType}',
);
}