-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
发现自定义的 customTransformers 执行会报错, 貌似是 ts2php 内置的 transformer 会破坏原 ast 的结构, 导致自定义的 transformer 里遍历 ast 会报错, 用的是 ts.visitEachChild 来遍历。
猜测是这里的处理有问题:
Line 215 in f511257
| function visitVariableDeclarationList(node: ts.VariableDeclarationList) { |
报错时正在处理这一行源码: const {name, data, outputData} = originalParams;
报错的调用是: node.getChildCount()
错误堆栈:
internal/process/warning.js:18 (node:56266) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'text' of undefined
at createChildren (/Project/node_modules/typescript/lib/typescript.js:120256:65)
at NodeObject.getChildren (/Project/node_modules/typescript/lib/typescript.js:120219:56)
at NodeObject.getChildCount (/Project/node_modules/typescript/lib/typescript.js:120212:25)
at SanIdTransformer.visitor (/Project/ts2phprc.js:105:27) // 在这里调用的 node.getChildCount()
Metadata
Metadata
Assignees
Labels
No labels
