Skip to content

Commit

Permalink
Fixed TypeError message when evaluating a.b["c"] where a.b is undefined.
Browse files Browse the repository at this point in the history
  • Loading branch information
dop251 committed Oct 15, 2015
1 parent 9d3cca2 commit 432b436
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmpl_evaluate_expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ func (self *_runtime) cmpl_evaluate_nodeBracketExpression(node *_nodeBracketExpr
memberValue := member.resolve()

// TODO Pass in base value as-is, and defer toObject till later?
return toValue(newPropertyReference(self, self.toObject(targetValue), memberValue.string(), false, _at(node.idx)))
object, err := self.objectCoerce(targetValue)
if err != nil {
panic(self.panicTypeError("Cannot access member '%s' of %s", memberValue.string(), err.Error(), _at(node.idx)))
}
return toValue(newPropertyReference(self, object, memberValue.string(), false, _at(node.idx)))
}

func (self *_runtime) cmpl_evaluate_nodeCallExpression(node *_nodeCallExpression, withArgumentList []interface{}) Value {
Expand Down

0 comments on commit 432b436

Please sign in to comment.