MCPcopy Create free account
hub / github.com/CashScript/cashscript / tagDescription

Function tagDescription

packages/utils/src/bitauth-script.ts:181–197  ·  view source on GitHub ↗
(tag: SourceTagEntry, locationData: FullLocationData, sourceLines: string[])

Source from the content-addressed store, hash-verified

179
180// e.g. ">>> for-loop update (i = i + 1)"
181function tagDescription(tag: SourceTagEntry, locationData: FullLocationData, sourceLines: string[]): string {
182 switch (tag.kind) {
183 case SourceTagKind.LOCKTIME_GUARD:
184 return '>>> tx.locktime guard (auto-injected)';
185 case SourceTagKind.PARAMETER_VALIDATION: {
186 const parameter = deriveSourceText(tag, locationData, sourceLines);
187 return `>>> parameter type check${parameter ? ` (${parameter})` : ''}`;
188 }
189 case SourceTagKind.SCOPE_CLEANUP:
190 return '>>> scope cleanup';
191 case SourceTagKind.LOOP_CONDITION:
192 return '>>> loop condition check';
193 case SourceTagKind.FOR_UPDATE:
194 default:
195 return `>>> for-loop update (${deriveSourceText(tag, locationData, sourceLines)})`;
196 }
197}
198
199function deriveIndent(headerLine: number, sourceLines: string[]): string {
200 const bodyLine = sourceLines.slice(headerLine).find((l) => l.trim().length > 0);

Callers 1

buildInsertionsFunction · 0.85

Calls 1

deriveSourceTextFunction · 0.85

Tested by

no test coverage detected