Skip to content

Commit

Permalink
fixed size->length caveat
Browse files Browse the repository at this point in the history
  • Loading branch information
benmarch committed Jun 24, 2015
1 parent dafb431 commit 33c177f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions dist/spel2js.js
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ Stack.prototype.search = function (el) {
}

//size() -> length
if (methodName === 'size' && args.length === 0) {
if (methodName === 'size' && Array.isArray(context)) {
return context.length;
}

Expand Down Expand Up @@ -1958,7 +1958,7 @@ Stack.prototype.search = function (el) {

//handle conversion of Java properties to JavaScript properties
//this might cause problems, I'll look into alternatives
if (propertyName === 'size') {
if (propertyName === 'size' && Array.isArray(context)) {
return context.length;
}

Expand Down
4 changes: 2 additions & 2 deletions dist/spel2js.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/ast/MethodReference.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
}

//size() -> length
if (methodName === 'size' && args.length === 0) {
if (methodName === 'size' && Array.isArray(context)) {
return context.length;
}

Expand Down
3 changes: 1 addition & 2 deletions src/ast/PropertyReference.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
}

//handle conversion of Java properties to JavaScript properties
//this might cause problems, I'll look into alternatives
if (propertyName === 'size') {
if (propertyName === 'size' && Array.isArray(context)) {
return context.length;
}

Expand Down

0 comments on commit 33c177f

Please sign in to comment.