1e25c9da306f38ddf7bd3c63ed7c9540b75384e0#commitcomment-719177

This commit is contained in:
Michael Ficarra 2011-11-14 11:18:45 -05:00
parent 1e25c9da30
commit d0b8cded6b
3 changed files with 5 additions and 2 deletions

View File

@ -23,7 +23,7 @@
Scope.prototype.add = function(name, type, immediate) {
if (this.shared && !immediate) return this.parent.add(name, type, immediate);
if (this.positions.hasOwnProperty(name)) {
if (Object.prototype.hasOwnProperty.call(this.positions, name)) {
return this.variables[this.positions[name]].type = type;
} else {
return this.positions[name] = this.variables.push({

View File

@ -25,7 +25,7 @@ exports.Scope = class Scope
# Adds a new variable or overrides an existing one.
add: (name, type, immediate) ->
return @parent.add name, type, immediate if @shared and not immediate
if @positions.hasOwnProperty name
if Object::hasOwnProperty.call @positions, name
@variables[@positions[name]].type = type
else
@positions[name] = @variables.push({name, type}) - 1

View File

@ -59,3 +59,6 @@ test "#1106: __proto__ compilation", ->
object = eq
@["__proto__"] = true
ok __proto__
test "reference named hasOwnProperty", ->
CoffeeScript.compile 'hasOwnProperty = 0; a = 1'