fixing mentionsArgs for accesses.
This commit is contained in:
parent
9395d58669
commit
97a29f9c50
|
@ -696,6 +696,7 @@
|
||||||
__extends(Access, Base);
|
__extends(Access, Base);
|
||||||
function Access(name, tag) {
|
function Access(name, tag) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
this.name.accessed = true;
|
||||||
this.proto = tag === 'proto' ? '.prototype' : '';
|
this.proto = tag === 'proto' ? '.prototype' : '';
|
||||||
this.soak = tag === 'soak';
|
this.soak = tag === 'soak';
|
||||||
}
|
}
|
||||||
|
@ -2121,10 +2122,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
literalArgs: function(node) {
|
literalArgs: function(node) {
|
||||||
return node instanceof Literal && node.value === 'arguments';
|
return node instanceof Literal && node.value === 'arguments' && !node.accessed;
|
||||||
},
|
},
|
||||||
literalThis: function(node) {
|
literalThis: function(node) {
|
||||||
return node instanceof Literal && node.value === 'this' || node instanceof Code && node.bound;
|
return (node instanceof Literal && node.value === 'this' && !node.accessed) || (node instanceof Code && node.bound);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
unfoldSoak = function(o, parent, name) {
|
unfoldSoak = function(o, parent, name) {
|
||||||
|
|
|
@ -557,6 +557,7 @@ exports.Extends = class Extends extends Base
|
||||||
# an access into the object's prototype.
|
# an access into the object's prototype.
|
||||||
exports.Access = class Access extends Base
|
exports.Access = class Access extends Base
|
||||||
constructor: (@name, tag) ->
|
constructor: (@name, tag) ->
|
||||||
|
@name.accessed = yes
|
||||||
@proto = if tag is 'proto' then '.prototype' else ''
|
@proto = if tag is 'proto' then '.prototype' else ''
|
||||||
@soak = tag is 'soak'
|
@soak = tag is 'soak'
|
||||||
|
|
||||||
|
@ -1671,9 +1672,11 @@ Closure =
|
||||||
call = new Call func, args
|
call = new Call func, args
|
||||||
if statement then Expressions.wrap [call] else call
|
if statement then Expressions.wrap [call] else call
|
||||||
|
|
||||||
literalArgs: (node) -> node instanceof Literal and node.value is 'arguments'
|
literalArgs: (node) ->
|
||||||
literalThis: (node) -> node instanceof Literal and node.value is 'this' or
|
node instanceof Literal and node.value is 'arguments' and not node.accessed
|
||||||
node instanceof Code and node.bound
|
literalThis: (node) ->
|
||||||
|
(node instanceof Literal and node.value is 'this' and not node.accessed) or
|
||||||
|
(node instanceof Code and node.bound)
|
||||||
|
|
||||||
# Unfold a node's child if soak, then tuck the node under created `If`
|
# Unfold a node's child if soak, then tuck the node under created `If`
|
||||||
unfoldSoak = (o, parent, name) ->
|
unfoldSoak = (o, parent, name) ->
|
||||||
|
|
|
@ -293,3 +293,10 @@ a = 0
|
||||||
for f in [-> a = 1] -> f()
|
for f in [-> a = 1] -> f()
|
||||||
|
|
||||||
eq a, 1
|
eq a, 1
|
||||||
|
|
||||||
|
|
||||||
|
# Comprehensions that mention arguments.
|
||||||
|
list = [arguments: 10]
|
||||||
|
args = for f in list -> f.arguments
|
||||||
|
|
||||||
|
eq args[0], 10
|
||||||
|
|
Loading…
Reference in New Issue