Files
reverse-engineering-anything/scripts/verify/limit-class-guard.mjs
T
morluto e09bbcaf5f refactor: report NativeAOT, Interface Builder and owned-MCP output limits through the shared limit owners (#11194)
* refactor: report NativeAOT, Interface Builder and owned-MCP output limits through the shared limit owners

* refactor(errors): carry a parser's required value on its limit reference and in adjustable-budget refusals (#11201)

* fix(android): keep the JADX output-limit refusal's retained process output

* refactor(native): name PE and native-export allowances in the BinaryResourceFailure limit (#11253)

PeImportLimitFailure, PeLoadConfigLimitFailure and NativeExportLimitFailure kept a parallel `limit` field beside the LimitRef their BinaryResourceFailure base already carries (named only "structure"). The allowance name now lives in the LimitRef, consumers read it with binaryResourceAllowance against the parser's exported allowance list, and the three subclasses are removed. The local-limit-error-class guard also counts limit subclasses of BinaryResourceFailure.
2026-11-16 00:02:47 +08:00

13 lines
675 B
JavaScript

// Counts local limit classes: a class whose name has Limit, Budget, Exhausted
// or Exceeded and that extends plain Error, or that extends
// BinaryResourceFailure, which already names its allowance in its LimitRef
// (a subclass would keep a second, parallel limit field). Type parameters and
// line breaks between tokens are allowed, as a formatter or a generic
// declaration may write them.
const localLimitClass =
/\bclass\s+\w*(?:Limit|Budget|Exhausted|Exceeded)\w*\s*(?:<[^{]*?>)?\s*extends\s+(?:Error|BinaryResourceFailure)\b/gu;
/** @param {string} content */
export const localLimitErrorClassCount = (content) =>
content.match(localLimitClass)?.length ?? 0;