Skip to content

Commit

Permalink
remove test code
Browse files Browse the repository at this point in the history
  • Loading branch information
so1ve committed May 6, 2024
1 parent 6bb8018 commit 915177d
Showing 1 changed file with 0 additions and 71 deletions.
71 changes: 0 additions & 71 deletions packages/language-core/lib/utils/parseBindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,74 +171,3 @@ export function getNodeText(
const { start, end } = getStartEnd(ts, node, sourceFile);
return sourceFile.text.substring(start, end);
}

// export function analyzeBindings(
// ts: typeof import('typescript'),
// ast: ts.SourceFile,
// vueCompilerOptions: VueCompilerOptions
// ) {
// const bindings = new Map<string, BindingTypes>();

// function worker(node: ts.Node) {
// if (ts.isVariableDeclaration(node)) {
// if (ts.isIdentifier(node.name)) {
// if (!node.initializer) {
// bindings.set(node.name.text, BindingTypes.NeedUnref);
// }
// else {
// if (ts.isCallExpression(node.initializer)) {
// const callText = node.initializer.expression.getText();
// if (vueCompilerOptions.macros.defineProps.includes(callText)) {
// if (node.initializer.typeArguments?.length === 1) {
// const typeNode = node.initializer.typeArguments[0];
// if (ts.isTypeLiteralNode(typeNode)) {
// for (const prop of typeNode.members) {
// if (ts.isPropertySignature(prop)) {
// bindings.set(_getNodeText(prop.name), BindingTypes.NoUnref);
// }
// }
// }
// }
// else if (node.initializer.arguments.length === 1) {
// const arg = node.initializer.arguments[0];
// if (ts.isObjectLiteralExpression(arg)) {
// for (const prop of arg.properties) {
// if (ts.isPropertyAssignment(prop)) {
// bindings.set(_getNodeText(prop.name), BindingTypes.NoUnref);
// }
// }
// }
// else if (ts.isArrayLiteralExpression(arg)) {
// for (const prop of arg.elements) {
// if (ts.isStringLiteral(prop)) {
// bindings.set(prop.text, BindingTypes.NoUnref);
// }
// }
// }
// }
// }
// else if (callText === 'ref') {
// bindings.set(node.name.text, BindingTypes.NeedUnref);
// }
// }
// }
// }
// }
// else {
// ts.forEachChild(node, worker);
// }
// }

// worker(ast);

// return bindings;
// };

// const ast = ts.createSourceFile('a.ts', `
// const a = ref()
// const b = defineProps({
// foo: Number
// })
// `, 99);

// console.log(analyzeBindings(ts, ast, resolveVueCompilerOptions({})));

0 comments on commit 915177d

Please sign in to comment.