1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

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() { exports.run = function() {
var arg, args, e, i, len, ref, results; var _error, arg, args, e, i, len, ref, results;
global.__originalDirname = fs.realpathSync('.'); global.__originalDirname = fs.realpathSync('.');
process.chdir(cakefileDirectory(__originalDirname)); process.chdir(cakefileDirectory(__originalDirname));
args = process.argv.slice(2); args = process.argv.slice(2);

View file

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

View file

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

View file

@ -2688,7 +2688,7 @@
o.indent += TAB; o.indent += TAB;
scope = o.scope; scope = o.scope;
tryPart = this.attempt.compileToFragments(o, LEVEL_TOP); 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 + "}")) : []; 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); 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, historyFile: process.env.HOME ? path.join(process.env.HOME, '.coffee_history') : void 0,
historyMaxInputSize: 10240, historyMaxInputSize: 10240,
"eval": function(input, context, filename, cb) { "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(/\uFF00/g, '\n');
input = input.replace(/^\(([\s\S]*)\n\)$/m, '$1'); input = input.replace(/^\(([\s\S]*)\n\)$/m, '$1');
ref1 = require('./nodes'), Block = ref1.Block, Assign = ref1.Assign, Value = ref1.Value, Literal = ref1.Literal; 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 tryPart = @attempt.compileToFragments o, LEVEL_TOP
catchPart = if @recovery catchPart = if @recovery
generatedErrorVariableName = scope.freeVariable '_error' generatedErrorVariableName = scope.freeVariable 'error'
placeholder = new Literal generatedErrorVariableName placeholder = new Literal generatedErrorVariableName
@recovery.unshift new Assign @errorVariable, placeholder if @errorVariable @recovery.unshift new Assign @errorVariable, placeholder if @errorVariable
[].concat @makeCode(" catch ("), placeholder.compileToFragments(o), @makeCode(") {\n"), [].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 eq 1, scope.a
try throw 'foo' try throw 'foo'
catch _error catch error
eq _error, 'foo' eq error, 'foo'
eq _error, 'foo' eq error, 'foo'
try throw 'bar'
catch __error
eq __error, 'bar'
eq __error, 'bar'
doesNotThrow -> CoffeeScript.compile '(@slice...) ->' doesNotThrow -> CoffeeScript.compile '(@slice...) ->'