diff --git a/Source/Function/Output/Transformer/Visit.ts b/Source/Function/Output/Transformer/Visit.ts index e9d79d02..f04b0a23 100644 --- a/Source/Function/Output/Transformer/Visit.ts +++ b/Source/Function/Output/Transformer/Visit.ts @@ -7,27 +7,11 @@ import type Interface from "@Interface/Output/Transformer/Visit.js"; export const Fn = ((Usage, Initializer) => (...[Context]) => (...[Node]) => { - // Node = ; - - if (ts.isVariableStatement(Node)) { - // // const declarations = Node.declarationList.declarations.filter( - // // (Declaration) => { - // // return (Usage.get(Declaration.name.getText()) ?? 0) > 1; - // // }, - // // ); - // // if (declarations.length === 0) { - // // return ts.factory.createEmptyStatement(); - // // } - // // return ts.factory.updateVariableStatement( - // // Node, - // // Node.modifiers, - // // ts.factory.updateVariableDeclarationList( - // // Node.declarationList, - // // declarations, - // // ), - // // ); - console.log(Node.getText()); - } + Node = ts.visitEachChild( + Node, + Fn(Usage, Initializer)(Context), + Context, + ); if (ts.isIdentifier(Node)) { const NameNode = Node.getText(); @@ -46,11 +30,7 @@ export const Fn = ((Usage, Initializer) => } } - return ts.visitEachChild( - Node, - Fn(Usage, Initializer)(Context), - Context, - ); + return Node; }) satisfies Interface as Interface; export const { default: ts } = await import("typescript"); diff --git a/Target/Function/Output/Transformer/Visit.js b/Target/Function/Output/Transformer/Visit.js index 32512d9f..e93b2e7a 100644 --- a/Target/Function/Output/Transformer/Visit.js +++ b/Target/Function/Output/Transformer/Visit.js @@ -1 +1 @@ -const o=(i,r)=>(...[a])=>(...[t])=>{if(e.isVariableStatement(t)&&console.log(t.getText()),e.isIdentifier(t)){const n=t.getText(),f=i.get(n),s=c(n,r);if(typeof s<"u"&&typeof f<"u"&&e.isCallExpression(t.parent)&&f===1)return e.factory.createIdentifier(s.getText())}return e.visitEachChild(t,o(i,r)(a),a)},{default:e}=await import("typescript"),{default:c}=await import("../../Output/Visit/Get.js");var p=o;export{o as Fn,c as Get,p as default,e as ts}; +const o=(r,i)=>(...[n])=>(...[t])=>{if(t=e.visitEachChild(t,o(r,i)(n),n),e.isIdentifier(t)){const a=t.getText(),f=r.get(a),s=c(a,i);if(typeof s<"u"&&typeof f<"u"&&e.isCallExpression(t.parent)&&f===1)return e.factory.createIdentifier(s.getText())}return t},{default:e}=await import("typescript"),{default:c}=await import("../../Output/Visit/Get.js");var p=o;export{o as Fn,c as Get,p as default,e as ts};