Removing the unnecessary underscore now :)

This commit is contained in:
Bruno Bernardino 2015-08-16 21:32:16 +01:00
parent efdc67241a
commit 93e4eeafed
7 changed files with 21 additions and 26 deletions

View File

@ -46,7 +46,7 @@
});
exports.run = function() {
var arg, args, e, i, len, ref, results;
var _error, arg, args, e, i, len, ref, results;
global.__originalDirname = fs.realpathSync('.');
process.chdir(cakefileDirectory(__originalDirname));
args = process.argv.slice(2);

View File

@ -26,7 +26,7 @@
withPrettyErrors = function(fn) {
return function(code, options) {
var err;
var _error, err;
if (options == null) {
options = {};
}
@ -217,7 +217,7 @@
}
exports._compileFile = function(filename, sourceMap) {
var answer, err, raw, stripped;
var _error, answer, err, raw, stripped;
if (sourceMap == null) {
sourceMap = false;
}

View File

@ -112,7 +112,7 @@
};
compilePath = function(source, topLevel, base) {
var code, err, file, files, i, len, results, stats;
var _error, _error1, _error2, code, err, file, files, i, len, results, stats;
if (indexOf.call(sources, source) >= 0 || watchedDirs[source] || !topLevel && (notSources[source] || hidden(source))) {
return;
}
@ -140,8 +140,8 @@
}
try {
files = fs.readdirSync(source);
} catch (_error) {
err = _error;
} catch (_error1) {
err = _error1;
if (err.code === 'ENOENT') {
return;
} else {
@ -163,8 +163,8 @@
}
try {
code = fs.readFileSync(source);
} catch (_error) {
err = _error;
} catch (_error2) {
err = _error2;
if (err.code === 'ENOENT') {
return;
} else {
@ -178,7 +178,7 @@
};
findDirectoryIndex = function(source) {
var err, ext, i, index, len, ref1;
var _error, err, ext, i, index, len, ref1;
ref1 = CoffeeScript.FILE_EXTENSIONS;
for (i = 0, len = ref1.length; i < len; i++) {
ext = ref1[i];
@ -199,7 +199,7 @@
};
compileScript = function(file, input, base) {
var compiled, err, message, o, options, t, task;
var _error, compiled, err, message, o, options, t, task;
if (base == null) {
base = null;
}
@ -289,11 +289,12 @@
};
watch = function(source, base) {
var compile, compileTimeout, err, prevStats, rewatch, startWatcher, watchErr, watcher;
var _error, compile, compileTimeout, err, prevStats, rewatch, startWatcher, watchErr, watcher;
watcher = null;
prevStats = null;
compileTimeout = null;
watchErr = function(err) {
var _error;
if (err.code !== 'ENOENT') {
throw err;
}
@ -352,7 +353,7 @@
};
watchDir = function(source, base) {
var err, readdirTimeout, startWatcher, stopWatcher, watcher;
var _error, err, readdirTimeout, startWatcher, stopWatcher, watcher;
watcher = null;
readdirTimeout = null;
startWatcher = function() {
@ -364,7 +365,7 @@
}).on('change', function() {
clearTimeout(readdirTimeout);
return readdirTimeout = wait(25, function() {
var err, file, files, i, len, results;
var _error, err, file, files, i, len, results;
try {
files = fs.readdirSync(source);
} catch (_error) {
@ -428,7 +429,7 @@
};
silentUnlink = function(path) {
var err, ref1;
var _error, err, ref1;
try {
return fs.unlinkSync(path);
} catch (_error) {

View File

@ -2688,7 +2688,7 @@
o.indent += TAB;
scope = o.scope;
tryPart = this.attempt.compileToFragments(o, LEVEL_TOP);
catchPart = this.recovery ? (generatedErrorVariableName = scope.freeVariable('_error'), placeholder = new Literal(generatedErrorVariableName), this.errorVariable ? this.recovery.unshift(new Assign(this.errorVariable, placeholder)) : void 0, [].concat(this.makeCode(" catch ("), placeholder.compileToFragments(o), this.makeCode(") {\n"), this.recovery.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab + "}"))) : !(this.ensure || this.recovery) ? [this.makeCode(" catch (" + generatedErrorVariableName + ") {}")] : [];
catchPart = this.recovery ? (generatedErrorVariableName = scope.freeVariable('error'), placeholder = new Literal(generatedErrorVariableName), this.errorVariable ? this.recovery.unshift(new Assign(this.errorVariable, placeholder)) : void 0, [].concat(this.makeCode(" catch ("), placeholder.compileToFragments(o), this.makeCode(") {\n"), this.recovery.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab + "}"))) : !(this.ensure || this.recovery) ? [this.makeCode(" catch (" + generatedErrorVariableName + ") {}")] : [];
ensurePart = this.ensure ? [].concat(this.makeCode(" finally {\n"), this.ensure.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab + "}")) : [];
return [].concat(this.makeCode(this.tab + "try {\n"), tryPart, this.makeCode("\n" + this.tab + "}"), catchPart, ensurePart);
};

View File

@ -19,7 +19,7 @@
historyFile: process.env.HOME ? path.join(process.env.HOME, '.coffee_history') : void 0,
historyMaxInputSize: 10240,
"eval": function(input, context, filename, cb) {
var Assign, Block, Literal, Value, ast, err, js, ref1, referencedVars, token, tokens;
var Assign, Block, Literal, Value, _error, ast, err, js, ref1, referencedVars, token, tokens;
input = input.replace(/\uFF00/g, '\n');
input = input.replace(/^\(([\s\S]*)\n\)$/m, '$1');
ref1 = require('./nodes'), Block = ref1.Block, Assign = ref1.Assign, Value = ref1.Value, Literal = ref1.Literal;

View File

@ -1896,7 +1896,7 @@ exports.Try = class Try extends Base
tryPart = @attempt.compileToFragments o, LEVEL_TOP
catchPart = if @recovery
generatedErrorVariableName = scope.freeVariable '_error'
generatedErrorVariableName = scope.freeVariable 'error'
placeholder = new Literal generatedErrorVariableName
@recovery.unshift new Assign @errorVariable, placeholder if @errorVariable
[].concat @makeCode(" catch ("), placeholder.compileToFragments(o), @makeCode(") {\n"),

View File

@ -444,16 +444,10 @@ test "#1500: Assignment to variables similar to generated variables", ->
eq 1, scope.a
try throw 'foo'
catch _error
eq _error, 'foo'
catch error
eq error, 'foo'
eq _error, 'foo'
try throw 'bar'
catch __error
eq __error, 'bar'
eq __error, 'bar'
eq error, 'foo'
doesNotThrow -> CoffeeScript.compile '(@slice...) ->'