diff --git a/lib/cake.js b/lib/cake.js index 7847ed19..d13f5b59 100755 --- a/lib/cake.js +++ b/lib/cake.js @@ -1,4 +1,4 @@ -(function(){ +(function() { var CoffeeScript, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks; fs = require('fs'); path = require('path'); diff --git a/lib/coffee-script.js b/lib/coffee-script.js index 2cd332f4..8c3d6235 100644 --- a/lib/coffee-script.js +++ b/lib/coffee-script.js @@ -1,4 +1,4 @@ -(function(){ +(function() { var Lexer, compile, helpers, lexer, parser, path, processScripts; if (typeof process !== "undefined" && process !== null) { path = require('path'); diff --git a/lib/command.js b/lib/command.js index 729cffda..fc898e70 100644 --- a/lib/command.js +++ b/lib/command.js @@ -1,4 +1,4 @@ -(function(){ +(function() { var BANNER, CoffeeScript, SWITCHES, _a, compileOptions, compileScript, compileScripts, compileStdio, exec, fs, lint, optionParser, options, optparse, parseOptions, path, printTokens, sources, spawn, usage, version, watch, writeJs; fs = require('fs'); path = require('path'); diff --git a/lib/grammar.js b/lib/grammar.js index 0b45b789..7ea43104 100644 --- a/lib/grammar.js +++ b/lib/grammar.js @@ -1,4 +1,4 @@ -(function(){ +(function() { var Parser, _a, _b, _c, _d, _e, _f, _g, _h, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap; var __hasProp = Object.prototype.hasOwnProperty; Parser = require('jison').Parser; diff --git a/lib/helpers.js b/lib/helpers.js index b041ef8b..76cff280 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -1,4 +1,4 @@ -(function(){ +(function() { var compact, count, del, ends, extend, flatten, helpers, include, indexOf, merge, starts; if (!(typeof process !== "undefined" && process !== null)) { this.exports = this; diff --git a/lib/index.js b/lib/index.js index 8e014e91..6bf0e654 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,4 +1,4 @@ -(function(){ +(function() { var _a, key, val; var __hasProp = Object.prototype.hasOwnProperty; _a = require('./coffee-script'); diff --git a/lib/lexer.js b/lib/lexer.js index 1fa546ad..946628d3 100644 --- a/lib/lexer.js +++ b/lib/lexer.js @@ -1,4 +1,4 @@ -(function(){ +(function() { var ASSIGNED, ASSIGNMENT, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_KEYWORDS, COMMENT, CONVERSIONS, HALF_ASSIGNMENTS, HEREDOC, HEREDOC_INDENT, IDENTIFIER, INTERPOLATION, JS_CLEANER, JS_FORBIDDEN, JS_KEYWORDS, LAST_DENT, LAST_DENTS, LINE_BREAK, Lexer, MULTILINER, MULTI_DENT, NEXT_CHARACTER, NOT_REGEX, NO_NEWLINE, NUMBER, OPERATOR, REGEX_END, REGEX_ESCAPE, REGEX_INTERPOLATION, REGEX_START, RESERVED, Rewriter, STRING_NEWLINES, WHITESPACE, _a, _b, _c, compact, count, helpers, include, starts; var __slice = Array.prototype.slice; if (typeof process !== "undefined" && process !== null) { diff --git a/lib/nodes.js b/lib/nodes.js index 46791365..46168b6a 100644 --- a/lib/nodes.js +++ b/lib/nodes.js @@ -1,7 +1,7 @@ -(function(){ +(function() { var AccessorNode, ArrayNode, AssignNode, BaseNode, CallNode, ClassNode, ClosureNode, CodeNode, CommentNode, DOUBLE_PARENS, ExistenceNode, Expressions, ExtendsNode, ForNode, IDENTIFIER, IS_STRING, IfNode, InNode, IndexNode, LiteralNode, NUMBER, ObjectNode, OpNode, ParentheticalNode, PushNode, RangeNode, ReturnNode, SIMPLENUM, Scope, SliceNode, SplatNode, TAB, TRAILING_WHITESPACE, ThrowNode, TryNode, UTILITIES, ValueNode, WhileNode, _a, compact, del, ends, flatten, helpers, include, indexOf, literal, merge, starts, utility; var __extends = function(child, parent) { - var ctor = function(){ }; + var ctor = function(){}; ctor.prototype = parent.prototype; child.prototype = new ctor(); child.prototype.constructor = child; @@ -230,7 +230,7 @@ code = this.compileWithDeclarations(o); code = code.replace(TRAILING_WHITESPACE, ''); code = code.replace(DOUBLE_PARENS, '($1)'); - return o.noWrap ? code : ("(function(){\n" + code + "\n})();\n"); + return o.noWrap ? code : ("(function() {\n" + code + "\n})();\n"); }; Expressions.prototype.compileWithDeclarations = function(o) { var code; @@ -500,7 +500,7 @@ } if (this.isNew) { utility('extends'); - return "(function() {\n" + (this.idt(1)) + "var ctor = function(){ };\n" + (this.idt(1)) + "__extends(ctor, " + meth + ");\n" + (this.idt(1)) + "return " + (meth) + ".apply(new ctor, " + (this.compileSplatArguments(o)) + ");\n" + this.tab + "}).call(this)"; + return "(function() {\n" + (this.idt(1)) + "var ctor = function(){};\n" + (this.idt(1)) + "__extends(ctor, " + meth + ");\n" + (this.idt(1)) + "return " + (meth) + ".apply(new ctor, " + (this.compileSplatArguments(o)) + ");\n" + this.tab + "}).call(this)"; } else { return "" + (this.prefix()) + (meth) + ".apply(" + obj + ", " + (this.compileSplatArguments(o)) + ")"; } @@ -641,7 +641,7 @@ body = ("var " + i + " = " + this.fromVar + "; " + clause + " " + i + " <" + this.equals + " " + this.toVar + " : " + i + " >" + this.equals + " " + this.toVar + "; " + clause + " " + i + " += 1 : " + i + " -= 1"); } post = ("{ " + (result) + ".push(" + i + ") };\n" + (idt) + "return " + result + ";\n" + o.indent); - return "(function(){" + (pre) + "\n" + (idt) + "for (" + body + ")" + post + "}).call(this)"; + return "(function() {" + (pre) + "\n" + (idt) + "for (" + body + ")" + post + "}).call(this)"; }; return RangeNode; })(); @@ -1681,7 +1681,7 @@ } }); UTILITIES = { - 'extends': "function(child, parent) {\n var ctor = function(){ };\n ctor.prototype = parent.prototype;\n child.prototype = new ctor();\n child.prototype.constructor = child;\n if (typeof parent.extended === \"function\") parent.extended(child);\n child.__superClass__ = parent.prototype;\n }", + 'extends': "function(child, parent) {\n var ctor = function(){};\n ctor.prototype = parent.prototype;\n child.prototype = new ctor();\n child.prototype.constructor = child;\n if (typeof parent.extended === \"function\") parent.extended(child);\n child.__superClass__ = parent.prototype;\n }", hasProp: 'Object.prototype.hasOwnProperty', slice: 'Array.prototype.slice' }; diff --git a/lib/optparse.js b/lib/optparse.js index 3db86122..839439f0 100755 --- a/lib/optparse.js +++ b/lib/optparse.js @@ -1,4 +1,4 @@ -(function(){ +(function() { var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments; exports.OptionParser = (function() { OptionParser = function(rules, banner) { diff --git a/lib/repl.js b/lib/repl.js index b33e3951..ca5584fe 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -1,4 +1,4 @@ -(function(){ +(function() { var CoffeeScript, helpers, readline, repl, run, stdio; CoffeeScript = require('./coffee-script'); helpers = require('./helpers').helpers; diff --git a/lib/rewriter.js b/lib/rewriter.js index 366170ec..ee180171 100644 --- a/lib/rewriter.js +++ b/lib/rewriter.js @@ -1,4 +1,4 @@ -(function(){ +(function() { var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, INVERSES, Rewriter, SINGLE_CLOSERS, SINGLE_LINERS, _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, helpers, include, pair; var __hasProp = Object.prototype.hasOwnProperty; if (typeof process !== "undefined" && process !== null) { diff --git a/lib/scope.js b/lib/scope.js index f299511f..149a65c4 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -1,4 +1,4 @@ -(function(){ +(function() { var Scope; var __hasProp = Object.prototype.hasOwnProperty; if (!(typeof process !== "undefined" && process !== null)) { diff --git a/src/nodes.coffee b/src/nodes.coffee index a8b4b02f..56958ced 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -209,7 +209,7 @@ exports.Expressions: class Expressions extends BaseNode code: @compileWithDeclarations(o) code: code.replace(TRAILING_WHITESPACE, '') code: code.replace(DOUBLE_PARENS, '($1)') - if o.noWrap then code else "(function(){\n$code\n})();\n" + if o.noWrap then code else "(function() {\n$code\n})();\n" # Compile the expressions body for the contents of a function, with # declarations of all inner variables pushed up to the top. @@ -459,7 +459,7 @@ exports.CallNode: class CallNode extends BaseNode utility 'extends' """ (function() { - ${@idt(1)}var ctor = function(){ }; + ${@idt(1)}var ctor = function(){}; ${@idt(1)}__extends(ctor, $meth); ${@idt(1)}return ${meth}.apply(new ctor, ${ @compileSplatArguments(o) }); $@tab}).call(this) @@ -590,7 +590,7 @@ exports.RangeNode: class RangeNode extends BaseNode clause: "$@fromVar <= $@toVar ?" body: "var $i = $@fromVar; $clause $i <$@equals $@toVar : $i >$@equals $@toVar; $clause $i += 1 : $i -= 1" post: "{ ${result}.push($i) };\n${idt}return $result;\n$o.indent" - "(function(){${pre}\n${idt}for ($body)$post}).call(this)" + "(function() {${pre}\n${idt}for ($body)$post}).call(this)" #### SliceNode @@ -1487,7 +1487,7 @@ UTILITIES: { # [goog.inherits](http://closure-library.googlecode.com/svn/docs/closureGoogBase.js.source.html#line1206). extends: """ function(child, parent) { - var ctor = function(){ }; + var ctor = function(){}; ctor.prototype = parent.prototype; child.prototype = new ctor(); child.prototype.constructor = child;