mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Make sure variables named e.g. "constructor" are declared with var
This commit is contained in:
parent
e4db6d47c2
commit
6bc7b56e6e
3 changed files with 3 additions and 3 deletions
|
@ -895,7 +895,7 @@
|
|||
// equivalent syntax tree and compile that, in pieces. You can see the
|
||||
// constructor, property assignments, and inheritance getting built out below.
|
||||
ClassNode.prototype.compileNode = function(o) {
|
||||
var _b, _c, _d, _e, access, applied, className, constScope, construct, extension, func, me, pname, prop, props, pvar, returns, val;
|
||||
var _b, _c, _d, _e, access, applied, className, constScope, construct, constructor, extension, func, me, pname, prop, props, pvar, returns, val;
|
||||
extension = this.parent && new ExtendsNode(this.variable, this.parent);
|
||||
props = new Expressions();
|
||||
o.top = true;
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
};
|
||||
// Just check to see if a variable has already been declared, without reserving.
|
||||
Scope.prototype.check = function(name) {
|
||||
if (this.variables[name]) {
|
||||
if (this.variables.hasOwnProperty(name)) {
|
||||
return true;
|
||||
}
|
||||
return !!(this.parent && this.parent.check(name));
|
||||
|
|
|
@ -46,7 +46,7 @@ exports.Scope: class Scope
|
|||
|
||||
# Just check to see if a variable has already been declared, without reserving.
|
||||
check: (name) ->
|
||||
return true if @variables[name]
|
||||
return true if @variables.hasOwnProperty name
|
||||
!!(@parent and @parent.check(name))
|
||||
|
||||
# If we need to store an intermediate result, find an available name for a
|
||||
|
|
Loading…
Add table
Reference in a new issue