From 9b9612e09ccf18d85502cb9d674f363b8d58fd42 Mon Sep 17 00:00:00 2001 From: satyr Date: Wed, 27 Jul 2011 18:49:48 +0900 Subject: [PATCH] fixed #1322; block comments no longer get out of implicitly called implicit objects --- lib/nodes.js | 2 +- src/nodes.coffee | 2 +- test/objects.coffee | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/nodes.js b/lib/nodes.js index bbf3e844..ecd2c718 100644 --- a/lib/nodes.js +++ b/lib/nodes.js @@ -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)); } diff --git a/src/nodes.coffee b/src/nodes.coffee index 0e448d38..42abc5c8 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -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 diff --git a/test/objects.coffee b/test/objects.coffee index c956d82a..ceefb068 100644 --- a/test/objects.coffee +++ b/test/objects.coffee @@ -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