mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Removing the utterly pointless splice in scope for the much more reasonable assignment.
This commit is contained in:
parent
303be86291
commit
8d6b909b93
2 changed files with 2 additions and 5 deletions
|
@ -27,10 +27,7 @@
|
|||
Scope.root = null;
|
||||
Scope.prototype.setVar = function(name, type) {
|
||||
if (this.positions.hasOwnProperty(name)) {
|
||||
return this.variables.splice(this.positions[name], 1, {
|
||||
name: name,
|
||||
type: type
|
||||
});
|
||||
return (this.variables[this.positions[name]].type = type);
|
||||
} else {
|
||||
this.positions[name] = this.variables.length;
|
||||
return this.variables.push({
|
||||
|
|
|
@ -29,7 +29,7 @@ exports.Scope = class Scope
|
|||
# Adds a new variable or overrides an existing one.
|
||||
setVar: (name, type) ->
|
||||
if @positions.hasOwnProperty name
|
||||
@variables.splice @positions[name], 1, {name, type}
|
||||
@variables[@positions[name]].type = type
|
||||
else
|
||||
@positions[name] = @variables.length
|
||||
@variables.push {name, type}
|
||||
|
|
Loading…
Add table
Reference in a new issue