Skip to content

Commit 68aa38e

Browse files
committed
fix copy-paste errors
1 parent dca6c0f commit 68aa38e

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,7 @@ var es5_visitors = (function () {
176176
var body = iifeRoot.node.body;
177177
for (var index in body) {
178178
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])) {
179+
if (isDecorateStatement(ci)) {
185180
// returns the node of the decorate (node.expression.right.callee)
186181
// __decorate([..])
187182
return ci.expression.right.arguments[0].elements;
@@ -194,12 +189,12 @@ var es5_visitors = (function () {
194189
function traverseForDecorateSpecial(path, config, depth) {
195190
var iifeRoot = _getParrent(path, depth);
196191

197-
var sibling = iifeRoot.getSibling(iifeRoot.key + 1);
198-
if (ci) {
199-
if (isDecorateStatement(ci)) {
192+
var sibling = iifeRoot.getSibling(iifeRoot.key + 1).node;
193+
if (sibling) {
194+
if (isDecorateStatement(sibling)) {
200195
// returns the node of the decorate (node.expression.right.callee)
201196
// __decorate([..])
202-
return ci.expression.right.arguments[0].elements;
197+
return sibling.expression.right.arguments[0].elements;
203198
}
204199
}
205200

android-static-binding-generator/tests/specs/ast-parser-tests.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ describe("parser/js_parser tests", function () {
186186

187187
let bindingsContent = fs.readFileSync(output, "utf-8").toString().trim().split('\n');
188188

189+
expect(bindingsContent.length).toBe(2);
190+
189191
for (let line of bindingsContent) {
190192
var lineParts = line.split("*");
191193
var tsExtendsPart = lineParts[1];

0 commit comments

Comments
 (0)