mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Making the spacing of symbols on function declaration consistent. No-space when single-line. Spaced when block. (StanAngeloff)
This commit is contained in:
parent
93d77e2354
commit
3b6f020f8a
13 changed files with 21 additions and 21 deletions
|
@ -1,4 +1,4 @@
|
|||
(function(){
|
||||
(function() {
|
||||
var CoffeeScript, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;
|
||||
fs = require('fs');
|
||||
path = require('path');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(){
|
||||
(function() {
|
||||
var Lexer, compile, helpers, lexer, parser, path, processScripts;
|
||||
if (typeof process !== "undefined" && process !== null) {
|
||||
path = require('path');
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(){
|
||||
(function() {
|
||||
var _a, key, val;
|
||||
var __hasProp = Object.prototype.hasOwnProperty;
|
||||
_a = require('./coffee-script');
|
||||
|
|
|
@ -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) {
|
||||
|
|
12
lib/nodes.js
12
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'
|
||||
};
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(){
|
||||
(function() {
|
||||
var CoffeeScript, helpers, readline, repl, run, stdio;
|
||||
CoffeeScript = require('./coffee-script');
|
||||
helpers = require('./helpers').helpers;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(){
|
||||
(function() {
|
||||
var Scope;
|
||||
var __hasProp = Object.prototype.hasOwnProperty;
|
||||
if (!(typeof process !== "undefined" && process !== null)) {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue