Skip to content

Commit dca6c0f

Browse files
committed
fix previous commit
1 parent 40dd832 commit dca6c0f

1 file changed

Lines changed: 21 additions & 16 deletions

File tree

android-static-binding-generator/project/parser/visitors/es5-visitors.js

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -171,22 +171,27 @@ var es5_visitors = (function () {
171171
}
172172
}
173173

174-
function traverseForDecorate(path, config, depth) {
175-
var iifeRoot = _getParrent(path, depth)
176-
var body = iifeRoot.node.body;
177-
for (var index in body) {
178-
var ci = body[index];
179-
if (isDecorateStatement(ci)) {
180-
// returns the node of the decorate (node.expression.right.callee)
181-
// __decorate([..])
182-
return ci.expression.right.arguments[0].elements;
183-
}
184-
}
185-
186-
return null;
187-
}
188-
189-
function traverseForDecorateSpecial(path, config, depth, classIndex) {
174+
function traverseForDecorate(path, config, depth) {
175+
var iifeRoot = _getParrent(path, depth)
176+
var body = iifeRoot.node.body;
177+
for (var index in body) {
178+
var ci = body[index];
179+
if (t.isExpressionStatement(ci) &&
180+
t.isAssignmentExpression(ci.expression) &&
181+
ci.expression.right.callee &&
182+
ci.expression.right.callee.name === "__decorate" &&
183+
ci.expression.right.arguments &&
184+
t.isArrayExpression(ci.expression.right.arguments[0])) {
185+
// returns the node of the decorate (node.expression.right.callee)
186+
// __decorate([..])
187+
return ci.expression.right.arguments[0].elements;
188+
}
189+
}
190+
191+
return null;
192+
}
193+
194+
function traverseForDecorateSpecial(path, config, depth) {
190195
var iifeRoot = _getParrent(path, depth);
191196

192197
var sibling = iifeRoot.getSibling(iifeRoot.key + 1);

0 commit comments

Comments
 (0)