From b31cc7023516d29346e6292c7ff637961ff36e82 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Sat, 2 Feb 2013 10:42:46 +1100 Subject: [PATCH] Moving the 'generated by coffeescript version X' comment to the bottom, to get it out of the way --- lib/coffee-script/browser.js | 3 ++- lib/coffee-script/cake.js | 3 ++- lib/coffee-script/coffee-script.js | 9 +++++---- lib/coffee-script/command.js | 3 ++- lib/coffee-script/grammar.js | 3 ++- lib/coffee-script/helpers.js | 3 ++- lib/coffee-script/index.js | 3 ++- lib/coffee-script/lexer.js | 3 ++- lib/coffee-script/nodes.js | 3 ++- lib/coffee-script/optparse.js | 3 ++- lib/coffee-script/repl.js | 3 ++- lib/coffee-script/rewriter.js | 3 ++- lib/coffee-script/scope.js | 3 ++- src/coffee-script.coffee | 4 ++-- test/compilation.coffee | 2 +- 15 files changed, 32 insertions(+), 19 deletions(-) diff --git a/lib/coffee-script/browser.js b/lib/coffee-script/browser.js index a0bc7079..636b57f4 100644 --- a/lib/coffee-script/browser.js +++ b/lib/coffee-script/browser.js @@ -1,4 +1,3 @@ -// Generated by CoffeeScript 1.5.0-pre (function() { var CoffeeScript, runScripts; @@ -90,3 +89,5 @@ } }).call(this); + +// Generated by CoffeeScript 1.5.0-pre diff --git a/lib/coffee-script/cake.js b/lib/coffee-script/cake.js index b8238471..e57da50a 100644 --- a/lib/coffee-script/cake.js +++ b/lib/coffee-script/cake.js @@ -1,4 +1,3 @@ -// Generated by CoffeeScript 1.5.0-pre (function() { var CoffeeScript, cakefileDirectory, existsSync, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks; @@ -111,3 +110,5 @@ }; }).call(this); + +// Generated by CoffeeScript 1.5.0-pre diff --git a/lib/coffee-script/coffee-script.js b/lib/coffee-script/coffee-script.js index 9f17ffde..8e23a73d 100644 --- a/lib/coffee-script/coffee-script.js +++ b/lib/coffee-script/coffee-script.js @@ -1,4 +1,3 @@ -// Generated by CoffeeScript 1.5.0-pre (function() { var Lexer, compile, ext, extensions, fs, lexer, loadFile, parser, path, vm, _i, _len, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, @@ -37,7 +36,7 @@ exports.helpers = require('./helpers'); exports.compile = compile = function(code, options) { - var header, js, merge; + var footer, js, merge; if (options == null) { options = {}; } @@ -53,8 +52,8 @@ } throw err; } - header = "Generated by CoffeeScript " + this.VERSION; - return "// " + header + "\n" + js; + footer = "Generated by CoffeeScript " + this.VERSION; + return "" + js + "\n// " + footer + "\n"; }; exports.tokens = function(code, options) { @@ -168,3 +167,5 @@ parser.yy = require('./nodes'); }).call(this); + +// Generated by CoffeeScript 1.5.0-pre diff --git a/lib/coffee-script/command.js b/lib/coffee-script/command.js index 8d2244ea..951ab8e0 100644 --- a/lib/coffee-script/command.js +++ b/lib/coffee-script/command.js @@ -1,4 +1,3 @@ -// Generated by CoffeeScript 1.5.0-pre (function() { var BANNER, CoffeeScript, EventEmitter, SWITCHES, coffee_exts, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, exists, forkNode, fs, helpers, hidden, joinTimeout, lint, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, removeSource, sourceCode, sources, spawn, timeLog, unwatchDir, usage, version, wait, watch, watchDir, watchers, writeJs, _ref, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; @@ -492,3 +491,5 @@ }; }).call(this); + +// Generated by CoffeeScript 1.5.0-pre diff --git a/lib/coffee-script/grammar.js b/lib/coffee-script/grammar.js index 36e95afe..f89857cc 100644 --- a/lib/coffee-script/grammar.js +++ b/lib/coffee-script/grammar.js @@ -1,4 +1,3 @@ -// Generated by CoffeeScript 1.5.0-pre (function() { var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap; @@ -610,3 +609,5 @@ }); }).call(this); + +// Generated by CoffeeScript 1.5.0-pre diff --git a/lib/coffee-script/helpers.js b/lib/coffee-script/helpers.js index 79fe2cdb..0a60fb2f 100644 --- a/lib/coffee-script/helpers.js +++ b/lib/coffee-script/helpers.js @@ -1,4 +1,3 @@ -// Generated by CoffeeScript 1.5.0-pre (function() { var extend, flatten, _ref; @@ -86,3 +85,5 @@ }; }).call(this); + +// Generated by CoffeeScript 1.5.0-pre diff --git a/lib/coffee-script/index.js b/lib/coffee-script/index.js index 250d547d..efed484f 100644 --- a/lib/coffee-script/index.js +++ b/lib/coffee-script/index.js @@ -1,4 +1,3 @@ -// Generated by CoffeeScript 1.5.0-pre (function() { var key, val, _ref; @@ -9,3 +8,5 @@ } }).call(this); + +// Generated by CoffeeScript 1.5.0-pre diff --git a/lib/coffee-script/lexer.js b/lib/coffee-script/lexer.js index ae99b9dd..45ac34bf 100644 --- a/lib/coffee-script/lexer.js +++ b/lib/coffee-script/lexer.js @@ -1,4 +1,3 @@ -// Generated by CoffeeScript 1.5.0-pre (function() { var BOM, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LITERATE, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, key, last, starts, _ref, _ref1, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; @@ -816,3 +815,5 @@ LINE_BREAK = ['INDENT', 'OUTDENT', 'TERMINATOR']; }).call(this); + +// Generated by CoffeeScript 1.5.0-pre diff --git a/lib/coffee-script/nodes.js b/lib/coffee-script/nodes.js index a1f42af8..53bd5c37 100644 --- a/lib/coffee-script/nodes.js +++ b/lib/coffee-script/nodes.js @@ -1,4 +1,3 @@ -// Generated by CoffeeScript 1.5.0-pre (function() { var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, Comment, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, compact, del, ends, extend, flatten, last, merge, multident, some, starts, unfoldSoak, utility, _ref, _ref1, __hasProp = {}.hasOwnProperty, @@ -2990,3 +2989,5 @@ }; }).call(this); + +// Generated by CoffeeScript 1.5.0-pre diff --git a/lib/coffee-script/optparse.js b/lib/coffee-script/optparse.js index 82210d99..2b42dd1f 100644 --- a/lib/coffee-script/optparse.js +++ b/lib/coffee-script/optparse.js @@ -1,4 +1,3 @@ -// Generated by CoffeeScript 1.5.0-pre (function() { var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments; @@ -136,3 +135,5 @@ }; }).call(this); + +// Generated by CoffeeScript 1.5.0-pre diff --git a/lib/coffee-script/repl.js b/lib/coffee-script/repl.js index 06f7f321..e722271f 100644 --- a/lib/coffee-script/repl.js +++ b/lib/coffee-script/repl.js @@ -1,4 +1,3 @@ -// Generated by CoffeeScript 1.5.0-pre (function() { var CoffeeScript, addMultilineHandler, merge, nodeREPL, replDefaults, vm; @@ -102,3 +101,5 @@ }; }).call(this); + +// Generated by CoffeeScript 1.5.0-pre diff --git a/lib/coffee-script/rewriter.js b/lib/coffee-script/rewriter.js index 00024cd4..a53fac0c 100644 --- a/lib/coffee-script/rewriter.js +++ b/lib/coffee-script/rewriter.js @@ -1,4 +1,3 @@ -// Generated by CoffeeScript 1.5.0-pre (function() { var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, left, rite, _i, _len, _ref, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, @@ -349,3 +348,5 @@ LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT']; }).call(this); + +// Generated by CoffeeScript 1.5.0-pre diff --git a/lib/coffee-script/scope.js b/lib/coffee-script/scope.js index d2924ef6..6c6cc947 100644 --- a/lib/coffee-script/scope.js +++ b/lib/coffee-script/scope.js @@ -1,4 +1,3 @@ -// Generated by CoffeeScript 1.5.0-pre (function() { var Scope, extend, last, _ref; @@ -144,3 +143,5 @@ })(); }).call(this); + +// Generated by CoffeeScript 1.5.0-pre diff --git a/src/coffee-script.coffee b/src/coffee-script.coffee index 1f72d840..6173e8b4 100644 --- a/src/coffee-script.coffee +++ b/src/coffee-script.coffee @@ -41,8 +41,8 @@ exports.compile = compile = (code, options = {}) -> catch err err.message = "In #{options.filename}, #{err.message}" if options.filename throw err - header = "Generated by CoffeeScript #{@VERSION}" - "// #{header}\n#{js}" + footer = "Generated by CoffeeScript #{@VERSION}" + "#{js}\n// #{footer}\n" # Tokenize a string of CoffeeScript code, and return the array of tokens. exports.tokens = (code, options) -> diff --git a/test/compilation.coffee b/test/compilation.coffee index 4b8397ae..5b81584b 100644 --- a/test/compilation.coffee +++ b/test/compilation.coffee @@ -15,7 +15,7 @@ test "--bare", -> test "header (#1778)", -> header = "// Generated by CoffeeScript #{CoffeeScript.VERSION}\n" - eq 0, CoffeeScript.compile('x = y', header: on).indexOf header + ok CoffeeScript.compile('x = y', header: on).indexOf(header) >= 0 test "header is disabled by default", -> header = "// Generated by CoffeeScript #{CoffeeScript.VERSION}\n"