Fix #1437. Unneeded ref in existential assignment.
This commit is contained in:
parent
8a59558e2d
commit
7b9699c5fa
|
@ -10,11 +10,10 @@
|
|||
compile = CoffeeScript.compile;
|
||||
|
||||
CoffeeScript["eval"] = function(code, options) {
|
||||
var _ref;
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
if ((_ref = options.bare) == null) {
|
||||
if (options.bare == null) {
|
||||
options.bare = true;
|
||||
}
|
||||
return eval(compile(code, options));
|
||||
|
|
|
@ -85,12 +85,12 @@
|
|||
};
|
||||
|
||||
exports.run = function(code, options) {
|
||||
var answer, mainModule, _ref;
|
||||
var answer, mainModule;
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
mainModule = require.main;
|
||||
if ((_ref = options.sourceMap) == null) {
|
||||
if (options.sourceMap == null) {
|
||||
options.sourceMap = true;
|
||||
}
|
||||
mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '.';
|
||||
|
|
|
@ -187,11 +187,11 @@
|
|||
};
|
||||
|
||||
exports.throwSyntaxError = function(message, location) {
|
||||
var error, _ref1, _ref2;
|
||||
if ((_ref1 = location.last_line) == null) {
|
||||
var error;
|
||||
if (location.last_line == null) {
|
||||
location.last_line = location.first_line;
|
||||
}
|
||||
if ((_ref2 = location.last_column) == null) {
|
||||
if (location.last_column == null) {
|
||||
location.last_column = location.first_column;
|
||||
}
|
||||
error = new SyntaxError(message);
|
||||
|
|
|
@ -776,17 +776,16 @@
|
|||
};
|
||||
|
||||
Value.prototype.unfoldSoak = function(o) {
|
||||
var _ref4,
|
||||
_this = this;
|
||||
return (_ref4 = this.unfoldedSoak) != null ? _ref4 : this.unfoldedSoak = (function() {
|
||||
var fst, i, ifn, prop, ref, snd, _i, _len, _ref5, _ref6;
|
||||
var _this = this;
|
||||
return this.unfoldedSoak != null ? this.unfoldedSoak : this.unfoldedSoak = (function() {
|
||||
var fst, i, ifn, prop, ref, snd, _i, _len, _ref4, _ref5;
|
||||
if (ifn = _this.base.unfoldSoak(o)) {
|
||||
(_ref5 = ifn.body.properties).push.apply(_ref5, _this.properties);
|
||||
(_ref4 = ifn.body.properties).push.apply(_ref4, _this.properties);
|
||||
return ifn;
|
||||
}
|
||||
_ref6 = _this.properties;
|
||||
for (i = _i = 0, _len = _ref6.length; _i < _len; i = ++_i) {
|
||||
prop = _ref6[i];
|
||||
_ref5 = _this.properties;
|
||||
for (i = _i = 0, _len = _ref5.length; _i < _len; i = ++_i) {
|
||||
prop = _ref5[i];
|
||||
if (!prop.soak) {
|
||||
continue;
|
||||
}
|
||||
|
@ -2309,7 +2308,7 @@
|
|||
|
||||
Op.prototype.compileExistence = function(o) {
|
||||
var fst, ref;
|
||||
if (this.first.isComplex()) {
|
||||
if (!o.isExistentialEquals && this.first.isComplex()) {
|
||||
ref = new Literal(o.scope.freeVariable('ref'));
|
||||
fst = new Parens(new Assign(ref, this.first));
|
||||
} else {
|
||||
|
|
|
@ -1641,8 +1641,9 @@ exports.Op = class Op extends Base
|
|||
(shared.compileToFragments o), @makeCode(" #{@operator} "), (@second.compileToFragments o, LEVEL_OP)
|
||||
@wrapInBraces fragments
|
||||
|
||||
# Keep reference to the left expression, unless this an existential assignment
|
||||
compileExistence: (o) ->
|
||||
if @first.isComplex()
|
||||
if !o.isExistentialEquals and @first.isComplex()
|
||||
ref = new Literal o.scope.freeVariable 'ref'
|
||||
fst = new Parens new Assign ref, @first
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue