fixed #1322; block comments no longer get out of implicitly called implicit objects

This commit is contained in:
satyr 2011-07-27 18:49:48 +09:00
parent d2d02bf91d
commit 9b9612e09c
3 changed files with 14 additions and 2 deletions

View File

@ -662,7 +662,7 @@
_ref2 = node.base.properties;
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
prop = _ref2[_j];
if (prop instanceof Assign) {
if (prop instanceof Assign || prop instanceof Comment) {
if (!obj) {
nodes.push(obj = new Obj(properties = [], true));
}

View File

@ -520,7 +520,7 @@ exports.Call = class Call extends Base
continue
obj = null
for prop in node.base.properties
if prop instanceof Assign
if prop instanceof Assign or prop instanceof Comment
nodes.push obj = new Obj properties = [], true if not obj
properties.push prop
else

View File

@ -221,3 +221,15 @@ test "#1436: `for` etc. work as normal property names", ->
eq no, obj.hasOwnProperty 'for'
obj.for = 'foo' of obj
eq yes, obj.hasOwnProperty 'for'
test "#1322: implicit call against implicit object with block comments", ->
((obj, arg) ->
eq obj.x * obj.y, 6
ok not arg
)
###
x
###
x: 2
### y ###
y: 3