diff --git a/lib/nodes.js b/lib/nodes.js index ecd2c718..11310622 100644 --- a/lib/nodes.js +++ b/lib/nodes.js @@ -1144,7 +1144,7 @@ } Assign.prototype.children = ['variable', 'value']; Assign.prototype.isStatement = function(o) { - return (o != null ? o.level : void 0) === LEVEL_TOP && __indexOf.call(this.context, "?") >= 0; + return (o != null ? o.level : void 0) === LEVEL_TOP && (this.context != null) && __indexOf.call(this.context, "?") >= 0; }; Assign.prototype.assigns = function(name) { return this[this.context === 'object' ? 'value' : 'variable'].assigns(name); diff --git a/src/nodes.coffee b/src/nodes.coffee index c40890ad..4e7afc3a 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -917,7 +917,7 @@ exports.Assign = class Assign extends Base children: ['variable', 'value'] isStatement: (o) -> - o?.level is LEVEL_TOP and "?" in @context + o?.level is LEVEL_TOP and @context? and "?" in @context assigns: (name) -> @[if @context is 'object' then 'value' else 'variable'].assigns name