Skip to content

Commit

Permalink
fix(transformer): 转换所有名为 wx 的引用型标识符,close #3953
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche committed Aug 16, 2019
1 parent d862e1e commit 8157ed9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/taroize/src/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ export function parseScript (
BlockStatement (path) {
path.scope.rename('wx', 'Taro')
},
Identifier (path) {
if (path.isReferenced() && path.node.name === 'wx') {
path.replaceWith(t.identifier('Taro'))
}
},
CallExpression (path) {
const callee = path.get('callee')
if (callee.isIdentifier()) {
Expand Down

0 comments on commit 8157ed9

Please sign in to comment.