fix: skip singleton_class in sequential parser to match worker behavior

This commit is contained in:
OpenClaw 2026-04-07 17:42:10 +05:30
parent f699ec92cf
commit b32ba5f8cb

View file

@ -239,7 +239,16 @@ const seqMethodMapCache = new Map<
function seqFindEnclosingClassNode(node: SyntaxNode): SyntaxNode | null {
let current = node.parent;
while (current) {
if (CLASS_CONTAINER_TYPES.has(current.type)) return current;
if (CLASS_CONTAINER_TYPES.has(current.type)) {
// Ruby singleton_class (class << self) has no name field u2014 skip it and
// continue walking up to find the actual class/module container.
// This matches the behavior in parse-worker.ts findEnclosingClassNode().
if (current.type === 'singleton_class') {
current = current.parent;
continue;
}
return current;
}
current = current.parent;
}
return null;