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

getting rid of excessive spaces after Class.name = "Class" assignment

This commit is contained in:
Michael Ficarra 2011-12-24 06:49:21 -05:00
parent 8d5f800e2f
commit 0c4cb309b0
6 changed files with 8 additions and 30 deletions

View file

@ -7,6 +7,7 @@
_ref2 = require('./helpers'), count = _ref2.count, starts = _ref2.starts, compact = _ref2.compact, last = _ref2.last; _ref2 = require('./helpers'), count = _ref2.count, starts = _ref2.starts, compact = _ref2.compact, last = _ref2.last;
exports.Lexer = Lexer = (function() { exports.Lexer = Lexer = (function() {
Lexer.name = 'Lexer'; Lexer.name = 'Lexer';
function Lexer() {} function Lexer() {}

View file

@ -30,6 +30,7 @@
}; };
exports.Base = Base = (function() { exports.Base = Base = (function() {
Base.name = 'Base'; Base.name = 'Base';
function Base() {} function Base() {}
@ -194,7 +195,6 @@
Block.name = 'Block'; Block.name = 'Block';
function Block(nodes) { function Block(nodes) {
this.expressions = compact(flatten(nodes || [])); this.expressions = compact(flatten(nodes || []));
} }
@ -395,7 +395,6 @@
Literal.name = 'Literal'; Literal.name = 'Literal';
function Literal(value) { function Literal(value) {
this.value = value; this.value = value;
} }
@ -454,7 +453,6 @@
Return.name = 'Return'; Return.name = 'Return';
function Return(expr) { function Return(expr) {
if (expr && !expr.unwrap().isUndefined) this.expression = expr; if (expr && !expr.unwrap().isUndefined) this.expression = expr;
} }
@ -491,7 +489,6 @@
Value.name = 'Value'; Value.name = 'Value';
function Value(base, props, tag) { function Value(base, props, tag) {
if (!props && base instanceof Value) return base; if (!props && base instanceof Value) return base;
this.base = base; this.base = base;
@ -642,7 +639,6 @@
Comment.name = 'Comment'; Comment.name = 'Comment';
function Comment(comment) { function Comment(comment) {
this.comment = comment; this.comment = comment;
} }
@ -668,7 +664,6 @@
Call.name = 'Call'; Call.name = 'Call';
function Call(variable, args, soak) { function Call(variable, args, soak) {
this.args = args != null ? args : []; this.args = args != null ? args : [];
this.soak = soak; this.soak = soak;
@ -840,7 +835,6 @@
Extends.name = 'Extends'; Extends.name = 'Extends';
function Extends(child, parent) { function Extends(child, parent) {
this.child = child; this.child = child;
this.parent = parent; this.parent = parent;
@ -862,7 +856,6 @@
Access.name = 'Access'; Access.name = 'Access';
function Access(name, tag) { function Access(name, tag) {
this.name = name; this.name = name;
this.name.asKey = true; this.name.asKey = true;
@ -893,7 +886,6 @@
Index.name = 'Index'; Index.name = 'Index';
function Index(index) { function Index(index) {
this.index = index; this.index = index;
} }
@ -918,7 +910,6 @@
Range.name = 'Range'; Range.name = 'Range';
Range.prototype.children = ['from', 'to']; Range.prototype.children = ['from', 'to'];
function Range(from, to, tag) { function Range(from, to, tag) {
@ -1004,7 +995,6 @@
Slice.name = 'Slice'; Slice.name = 'Slice';
Slice.prototype.children = ['range']; Slice.prototype.children = ['range'];
function Slice(range) { function Slice(range) {
@ -1033,7 +1023,6 @@
Obj.name = 'Obj'; Obj.name = 'Obj';
function Obj(props, generated) { function Obj(props, generated) {
this.generated = generated != null ? generated : false; this.generated = generated != null ? generated : false;
this.objects = this.properties = props || []; this.objects = this.properties = props || [];
@ -1102,7 +1091,6 @@
Arr.name = 'Arr'; Arr.name = 'Arr';
function Arr(objs) { function Arr(objs) {
this.objects = objs || []; this.objects = objs || [];
} }
@ -1153,7 +1141,6 @@
Class.name = 'Class'; Class.name = 'Class';
function Class(variable, parent, body) { function Class(variable, parent, body) {
this.variable = variable; this.variable = variable;
this.parent = parent; this.parent = parent;
@ -1287,7 +1274,7 @@
this.body.spaced = true; this.body.spaced = true;
if (!(this.ctor instanceof Code)) this.body.expressions.unshift(this.ctor); if (!(this.ctor instanceof Code)) this.body.expressions.unshift(this.ctor);
if (decl) { if (decl) {
this.body.expressions.unshift(new Literal("" + name + ".name = '" + name + "'")); this.body.expressions.unshift(new Assign(new Value(new Literal(name), [new Access(new Literal('name'))]), new Literal("'" + name + "'")));
} }
this.body.expressions.push(lname); this.body.expressions.push(lname);
this.addBoundFunctions(o); this.addBoundFunctions(o);
@ -1313,7 +1300,6 @@
Assign.name = 'Assign'; Assign.name = 'Assign';
function Assign(variable, value, context, options) { function Assign(variable, value, context, options) {
this.variable = variable; this.variable = variable;
this.value = value; this.value = value;
@ -1514,7 +1500,6 @@
Code.name = 'Code'; Code.name = 'Code';
function Code(params, body, tag) { function Code(params, body, tag) {
this.params = params || []; this.params = params || [];
this.body = body || new Block; this.body = body || new Block;
@ -1629,7 +1614,6 @@
Param.name = 'Param'; Param.name = 'Param';
function Param(name, value, splat) { function Param(name, value, splat) {
this.name = name; this.name = name;
this.value = value; this.value = value;
@ -1671,7 +1655,6 @@
Splat.name = 'Splat'; Splat.name = 'Splat';
Splat.prototype.children = ['name']; Splat.prototype.children = ['name'];
Splat.prototype.isAssignable = YES; Splat.prototype.isAssignable = YES;
@ -1740,7 +1723,6 @@
While.name = 'While'; While.name = 'While';
function While(condition, options) { function While(condition, options) {
this.condition = (options != null ? options.invert : void 0) ? condition.invert() : condition; this.condition = (options != null ? options.invert : void 0) ? condition.invert() : condition;
this.guard = options != null ? options.guard : void 0; this.guard = options != null ? options.guard : void 0;
@ -1816,7 +1798,6 @@
Op.name = 'Op'; Op.name = 'Op';
function Op(op, first, second, flip) { function Op(op, first, second, flip) {
if (op === 'in') return new In(first, second); if (op === 'in') return new In(first, second);
if (op === 'do') return this.generateDo(first); if (op === 'do') return this.generateDo(first);
@ -1984,7 +1965,6 @@
In.name = 'In'; In.name = 'In';
function In(object, array) { function In(object, array) {
this.object = object; this.object = object;
this.array = array; this.array = array;
@ -2059,7 +2039,6 @@
Try.name = 'Try'; Try.name = 'Try';
function Try(attempt, error, recovery, ensure) { function Try(attempt, error, recovery, ensure) {
this.attempt = attempt; this.attempt = attempt;
this.error = error; this.error = error;
@ -2102,7 +2081,6 @@
Throw.name = 'Throw'; Throw.name = 'Throw';
function Throw(expression) { function Throw(expression) {
this.expression = expression; this.expression = expression;
} }
@ -2129,7 +2107,6 @@
Existence.name = 'Existence'; Existence.name = 'Existence';
function Existence(expression) { function Existence(expression) {
this.expression = expression; this.expression = expression;
} }
@ -2165,7 +2142,6 @@
Parens.name = 'Parens'; Parens.name = 'Parens';
function Parens(body) { function Parens(body) {
this.body = body; this.body = body;
} }
@ -2206,7 +2182,6 @@
For.name = 'For'; For.name = 'For';
function For(body, source) { function For(body, source) {
var _ref2; var _ref2;
this.source = source.source, this.guard = source.guard, this.step = source.step, this.name = source.name, this.index = source.index; this.source = source.source, this.guard = source.guard, this.step = source.step, this.name = source.name, this.index = source.index;
@ -2348,7 +2323,6 @@
Switch.name = 'Switch'; Switch.name = 'Switch';
function Switch(subject, cases, otherwise) { function Switch(subject, cases, otherwise) {
this.subject = subject; this.subject = subject;
this.cases = cases; this.cases = cases;
@ -2426,7 +2400,6 @@
If.name = 'If'; If.name = 'If';
function If(condition, body, options) { function If(condition, body, options) {
this.body = body; this.body = body;
if (options == null) options = {}; if (options == null) options = {};

View file

@ -2,6 +2,7 @@
var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments; var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments;
exports.OptionParser = OptionParser = (function() { exports.OptionParser = OptionParser = (function() {
OptionParser.name = 'OptionParser'; OptionParser.name = 'OptionParser';
function OptionParser(rules, banner) { function OptionParser(rules, banner) {

View file

@ -4,6 +4,7 @@
__slice = Array.prototype.slice; __slice = Array.prototype.slice;
exports.Rewriter = (function() { exports.Rewriter = (function() {
Rewriter.name = 'Rewriter'; Rewriter.name = 'Rewriter';
function Rewriter() {} function Rewriter() {}

View file

@ -4,6 +4,7 @@
_ref = require('./helpers'), extend = _ref.extend, last = _ref.last; _ref = require('./helpers'), extend = _ref.extend, last = _ref.last;
exports.Scope = Scope = (function() { exports.Scope = Scope = (function() {
Scope.name = 'Scope'; Scope.name = 'Scope';
Scope.root = null; Scope.root = null;

View file

@ -942,7 +942,8 @@ exports.Class = class Class extends Base
@ensureConstructor name @ensureConstructor name
@body.spaced = yes @body.spaced = yes
@body.expressions.unshift @ctor unless @ctor instanceof Code @body.expressions.unshift @ctor unless @ctor instanceof Code
@body.expressions.unshift new Literal "#{name}.name = '#{name}'" if decl if decl
@body.expressions.unshift new Assign (new Value (new Literal name), [new Access new Literal 'name']), (new Literal "'#{name}'")
@body.expressions.push lname @body.expressions.push lname
@addBoundFunctions o @addBoundFunctions o