1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

nodes: continue while .. over while .. then

This commit is contained in:
satyr 2010-10-25 01:05:37 +09:00
parent cecae0f965
commit aed0e8790e
2 changed files with 6 additions and 8 deletions

View file

@ -243,7 +243,7 @@
Expressions.prototype.compileExpression = function(node, o) {
var code;
while (node !== (node = node.unwrap())) {
continue;
}
node = node.unfoldSoak(o) || node;
node.tags.front = true;
@ -997,14 +997,13 @@
return new Op(this.context.slice(0, -1), left, new Assign(rite, this.value)).compile(o);
};
Assign.prototype.matchParens = function(o, obj) {
var _ref2, idx;
while (obj !== (obj = obj.unwrap())) {
continue;
}
if (!(obj instanceof Literal || obj instanceof Value)) {
throw SyntaxError('nonreference in destructuring assignment shorthand.');
}
return _ref2 = Value.wrap(obj).cacheReference(o), obj = _ref2[0], idx = _ref2[1], _ref2;
return Value.wrap(obj).cacheReference(o);
};
return Assign;
})();

View file

@ -232,7 +232,7 @@ exports.Expressions = class Expressions extends Base
# return the result, and it's an expression, simply return it. If it's a
# statement, ask the statement to do so.
compileExpression: (node, o) ->
while node isnt node = node.unwrap() then
continue until node is node = node.unwrap()
node = node.unfoldSoak(o) or node
node.tags.front = on
o.level = LEVEL_TOP
@ -846,11 +846,10 @@ exports.Assign = class Assign extends Base
return new Op(@context.slice(0, -1), left, new Assign(rite, @value)).compile o
matchParens: (o, obj) ->
until obj is obj = obj.unwrap() then
continue until obj is obj = obj.unwrap()
unless obj instanceof Literal or obj instanceof Value
throw SyntaxError 'nonreference in destructuring assignment shorthand.'
[obj, idx] = Value.wrap(obj).cacheReference o
Value.wrap(obj).cacheReference o
#### Code