All files / TRANSPILE/3-Render/codegen/types IStringConcatOps.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31                                                             
/**
 * Operands of a string concatenation, as generated C expressions plus the
 * capacities the copy has to fit into.
 *
 * `left` and `right` hold generated code, not values -- `a + b` yields "a" and
 * "b", and either may be an arbitrary expression. The capacities are byte
 * counts known at compile time, which is what lets the emitted `strncpy`/
 * `strncat` pair be bounded rather than trusting the source.
 *
 * Extracted for the same reason as its sibling `ISubstringOps`, whose own doc
 * records it: "the same four fields were declared in four places and any change
 * to one of them needed four edits". This shape was declared THREE times --
 * `StringOperationsHelper` (which produces it), `StringDeclHelper` and
 * `VariableDeclHelper` (which each name it in a callback signature) -- all
 * byte-identical, so the rule was being followed for one of the two operand
 * types and not the other. CLAUDE.md: "If two interfaces need the same fields,
 * extract a shared type."
 */
interface IStringConcatOps {
  /** Generated C expression for the left operand */
  left: string;
  /** Generated C expression for the right operand */
  right: string;
  /** Capacity of the left operand in bytes, known at compile time */
  leftCapacity: number;
  /** Capacity of the right operand in bytes, known at compile time */
  rightCapacity: number;
}
 
export default IStringConcatOps;