#!/usr/bin/env bun import { readFileSync } from 'fs'; import createNode from './src/ast-builder/index.ts'; import * as ts from 'typescript'; console.log('πŸ” Debug private parameter test AST nodes...\n'); // 读取 AST ζ–‡δ»Ά const ast = JSON.parse(readFileSync('samples/private-param-test.ast.json', 'utf-8')); const rootId = ast.versions[ast.versions.length - 1].root_node_id; console.log(`Root node ID: ${rootId}\n`); // θŽ·ε–ζ ΉθŠ‚η‚ΉεΉΆι€’ε½’ζ£€ζŸ₯ζ‰€ζœ‰θŠ‚η‚Ή function checkNode(nodeId: string, depth = 0): void { const node = ast.nodes[nodeId]; if (!node) { console.log(`${' '.repeat(depth)}❌ Node ${nodeId} not found!`); return; } const indent = ' '.repeat(depth); try { // εˆ›ε»ΊθŠ‚η‚Ή const tsNode = createNode(ast, node); const kindName = ts.SyntaxKind[node.kind] || `Unknown(${node.kind})`; const tsKindName = ts.SyntaxKind[tsNode.kind] || `Unknown(${tsNode.kind})`; if (tsNode.kind === ts.SyntaxKind.Unknown) { console.log(`${indent}❌ Node ${nodeId}: ${kindName} (${node.kind}) -> Created: ${tsKindName} (${tsNode.kind}) UNKNOWN!`); if (node.text) { console.log(`${indent} Text: "${node.text}"`); } } else { console.log(`${indent}βœ… Node ${nodeId}: ${kindName} (${node.kind}) -> Created: ${tsKindName} (${tsNode.kind})`); } // ζ£€ζŸ₯ε­θŠ‚η‚Ή if (node.children) { for (const childId of node.children) { checkNode(childId, depth + 1); } } } catch (error: any) { console.log(`${indent}πŸ’₯ Failed to create node ${nodeId}: ${error.message}`); } } checkNode(rootId);