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

Update output

This commit is contained in:
Geoffrey Booth 2018-01-15 19:06:57 -08:00
parent 7ea3ea92f3
commit 3ade25a32c
4 changed files with 45 additions and 47 deletions

View file

@ -77,7 +77,7 @@
// all script tags with a content-type of `text/coffeescript`.
// This happens on page load.
runScripts = function() {
var coffees, coffeetypes, execute, fn, i, index, j, len, s, script, scripts;
var coffees, coffeetypes, execute, i, index, j, len, s, script, scripts;
scripts = window.document.getElementsByTagName('script');
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript'];
coffees = (function() {
@ -101,32 +101,31 @@
return execute();
}
};
fn = function(script, i) {
var options, source;
options = {
literate: script.type === coffeetypes[1]
};
source = script.src || script.getAttribute('data-src');
if (source) {
options.filename = source;
return CoffeeScript.load(source, function(param) {
coffees[i] = param;
return execute();
}, options, true);
} else {
// `options.filename` defines the filename the source map appears as
// in Developer Tools. If a script tag has an `id`, use that as the
// filename; otherwise use `coffeescript`, or `coffeescript1` etc.,
// leaving the first one unnumbered for the common case that theres
// only one CoffeeScript script block to parse.
options.filename = script.id && script.id !== '' ? script.id : `coffeescript${(i !== 0 ? i : '')}`;
options.sourceFiles = ['embedded'];
return coffees[i] = [script.innerHTML, options];
}
};
for (i = j = 0, len = coffees.length; j < len; i = ++j) {
script = coffees[i];
fn(script, i);
(function(script, i) {
var options, source;
options = {
literate: script.type === coffeetypes[1]
};
source = script.src || script.getAttribute('data-src');
if (source) {
options.filename = source;
return CoffeeScript.load(source, function(param) {
coffees[i] = param;
return execute();
}, options, true);
} else {
// `options.filename` defines the filename the source map appears as
// in Developer Tools. If a script tag has an `id`, use that as the
// filename; otherwise use `coffeescript`, or `coffeescript1` etc.,
// leaving the first one unnumbered for the common case that theres
// only one CoffeeScript script block to parse.
options.filename = script.id && script.id !== '' ? script.id : `coffeescript${(i !== 0 ? i : '')}`;
options.sourceFiles = ['embedded'];
return coffees[i] = [script.innerHTML, options];
}
})(script, i);
}
return execute();
};

View file

@ -1,7 +1,7 @@
// Generated by CoffeeScript 2.1.1
(function() {
// Node.js Implementation
var CoffeeScript, ext, fn, fs, helpers, i, len, path, ref, universalCompile, vm,
var CoffeeScript, ext, fs, helpers, i, len, path, ref, universalCompile, vm,
hasProp = {}.hasOwnProperty;
CoffeeScript = require('./coffeescript');
@ -137,15 +137,14 @@
// Throw error with deprecation warning when depending upon implicit `require.extensions` registration
if (require.extensions) {
ref = CoffeeScript.FILE_EXTENSIONS;
fn = function(ext) {
var base;
return (base = require.extensions)[ext] != null ? base[ext] : base[ext] = function() {
throw new Error(`Use CoffeeScript.register() or require the coffeescript/register module to require ${ext} files.`);
};
};
for (i = 0, len = ref.length; i < len; i++) {
ext = ref[i];
fn(ext);
(function(ext) {
var base;
return (base = require.extensions)[ext] != null ? base[ext] : base[ext] = function() {
throw new Error(`Use CoffeeScript.register() or require the coffeescript/register module to require ${ext} files.`);
};
})(ext);
}
}

View file

@ -1200,8 +1200,8 @@
if (this.expression) {
answer = this.expression.compileToFragments(o, LEVEL_PAREN);
unshiftAfterComments(answer, this.makeCode(`${this.tab}return `));
// Since the `return` got indented by `@tab`, preceding comments that are
// multiline need to be indented.
// Since the `return` got indented by `@tab`, preceding comments that are
// multiline need to be indented.
for (j = 0, len1 = answer.length; j < len1; j++) {
fragment = answer[j];
if (fragment.isHereComment && indexOf.call(fragment.code, '\n') >= 0) {
@ -3540,16 +3540,16 @@
vvar = [this.makeCode(ref)];
vvarText = ref;
}
// And here comes the big loop that handles all of these cases:
// `[a, b] = c`
// `[a..., b] = c`
// `[..., a, b] = c`
// `[@a, b] = c`
// `[a = 1, b] = c`
// `{a, b} = c`
// `{@a, b} = c`
// `{a = 1, b} = c`
// etc.
// And here comes the big loop that handles all of these cases:
// `[a, b] = c`
// `[a..., b] = c`
// `[..., a, b] = c`
// `[@a, b] = c`
// `[a = 1, b] = c`
// `{a, b} = c`
// `{@a, b} = c`
// `{a = 1, b} = c`
// etc.
for (i = j = 0, len1 = objects.length; j < len1; i = ++j) {
obj = objects[i];
idx = i;

View file

@ -44,8 +44,8 @@
// `--` argument after, because that will fail on Linux (see #3946).
({rules, positional} = normalizeArguments(args, this.rules.flagDict));
options = {};
// The `argument` field is added to the rule instance non-destructively by
// `normalizeArguments`.
// The `argument` field is added to the rule instance non-destructively by
// `normalizeArguments`.
for (i = 0, len = rules.length; i < len; i++) {
({hasArgument, argument, isList, name} = rules[i]);
if (hasArgument) {