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

removing __range, and all the slice behavior it enabled. If you can't do array[-1], then you shouldn't be able to do array[0..-1] -- it's just too inconsistent.

This commit is contained in:
Jeremy Ashkenas 2010-03-30 20:06:44 -04:00
parent 998a7c8cb0
commit 864275f07e
7 changed files with 48 additions and 150 deletions

View file

@ -1,11 +1,5 @@
(function(){
var BANNER, CoffeeScript, SWITCHES, compile_options, compile_script, compile_scripts, compile_stdio, fs, lint, option_parser, options, optparse, parse_options, path, print_tokens, sources, usage, version, watch_scripts, write_js;
var __range = function(array, from, to, exclusive) {
return [
(from < 0 ? from + array.length : from || 0),
(to < 0 ? to + array.length : to || array.length) + (exclusive ? 0 : 1)
];
};
// The `coffee` utility. Handles command-line compilation of CoffeeScript
// into various forms: saved into `.js` files or printed to stdout, piped to
// [JSLint](http://javascriptlint.com/) or recompiled every time the source is
@ -51,8 +45,8 @@
separator = sources.indexOf('--');
flags = [];
if (separator >= 0) {
flags = sources.slice.apply(sources, __range(sources, (separator + 1), sources.length, true));
sources = sources.slice.apply(sources, __range(sources, 0, separator, true));
flags = sources.slice((separator + 1), sources.length);
sources = sources.slice(0, separator);
}
process.ARGV = (process.argv = flags);
if (options.watch) {
@ -208,7 +202,7 @@
o = (options = option_parser.parse(process.argv));
options.run = !(o.compile || o.print || o.lint);
options.print = !!(o.print || (o.eval || o.stdio && o.compile));
sources = options.arguments.slice.apply(options.arguments, __range(options.arguments, 2, options.arguments.length, true));
sources = options.arguments.slice(2, options.arguments.length);
return sources;
};
// The compile-time options to pass to the CoffeeScript compiler.