1e25c9da306f38ddf7bd3c63ed7c9540b75384e0#commitcomment-719177
This commit is contained in:
parent
1e25c9da30
commit
d0b8cded6b
|
@ -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({
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -59,3 +59,6 @@ test "#1106: __proto__ compilation", ->
|
|||
object = eq
|
||||
@["__proto__"] = true
|
||||
ok __proto__
|
||||
|
||||
test "reference named hasOwnProperty", ->
|
||||
CoffeeScript.compile 'hasOwnProperty = 0; a = 1'
|
||||
|
|
Loading…
Reference in New Issue