mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
fixes #2052: don't manually assign constructors' name
property
I'm not sure how we would test this, so... no tests.
This commit is contained in:
parent
08673261b1
commit
f3a1f46679
6 changed files with 0 additions and 71 deletions
|
@ -9,8 +9,6 @@
|
|||
|
||||
exports.Lexer = Lexer = (function() {
|
||||
|
||||
Lexer.name = 'Lexer';
|
||||
|
||||
function Lexer() {}
|
||||
|
||||
Lexer.prototype.tokenize = function(code, opts) {
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
|
||||
exports.Base = Base = (function() {
|
||||
|
||||
Base.name = 'Base';
|
||||
|
||||
function Base() {}
|
||||
|
||||
Base.prototype.compile = function(o, lvl) {
|
||||
|
@ -210,8 +208,6 @@
|
|||
|
||||
__extends(Block, _super);
|
||||
|
||||
Block.name = 'Block';
|
||||
|
||||
function Block(nodes) {
|
||||
this.expressions = compact(flatten(nodes || []));
|
||||
}
|
||||
|
@ -432,8 +428,6 @@
|
|||
|
||||
__extends(Literal, _super);
|
||||
|
||||
Literal.name = 'Literal';
|
||||
|
||||
function Literal(value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
@ -492,8 +486,6 @@
|
|||
|
||||
__extends(Return, _super);
|
||||
|
||||
Return.name = 'Return';
|
||||
|
||||
function Return(expr) {
|
||||
if (expr && !expr.unwrap().isUndefined) {
|
||||
this.expression = expr;
|
||||
|
@ -530,8 +522,6 @@
|
|||
|
||||
__extends(Value, _super);
|
||||
|
||||
Value.name = 'Value';
|
||||
|
||||
function Value(base, props, tag) {
|
||||
if (!props && base instanceof Value) {
|
||||
return base;
|
||||
|
@ -698,8 +688,6 @@
|
|||
|
||||
__extends(Comment, _super);
|
||||
|
||||
Comment.name = 'Comment';
|
||||
|
||||
function Comment(comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
@ -725,8 +713,6 @@
|
|||
|
||||
__extends(Call, _super);
|
||||
|
||||
Call.name = 'Call';
|
||||
|
||||
function Call(variable, args, soak) {
|
||||
this.args = args != null ? args : [];
|
||||
this.soak = soak;
|
||||
|
@ -912,8 +898,6 @@
|
|||
|
||||
__extends(Extends, _super);
|
||||
|
||||
Extends.name = 'Extends';
|
||||
|
||||
function Extends(child, parent) {
|
||||
this.child = child;
|
||||
this.parent = parent;
|
||||
|
@ -933,8 +917,6 @@
|
|||
|
||||
__extends(Access, _super);
|
||||
|
||||
Access.name = 'Access';
|
||||
|
||||
function Access(name, tag) {
|
||||
this.name = name;
|
||||
this.name.asKey = true;
|
||||
|
@ -963,8 +945,6 @@
|
|||
|
||||
__extends(Index, _super);
|
||||
|
||||
Index.name = 'Index';
|
||||
|
||||
function Index(index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
@ -987,8 +967,6 @@
|
|||
|
||||
__extends(Range, _super);
|
||||
|
||||
Range.name = 'Range';
|
||||
|
||||
Range.prototype.children = ['from', 'to'];
|
||||
|
||||
function Range(from, to, tag) {
|
||||
|
@ -1090,8 +1068,6 @@
|
|||
|
||||
__extends(Slice, _super);
|
||||
|
||||
Slice.name = 'Slice';
|
||||
|
||||
Slice.prototype.children = ['range'];
|
||||
|
||||
function Slice(range) {
|
||||
|
@ -1118,8 +1094,6 @@
|
|||
|
||||
__extends(Obj, _super);
|
||||
|
||||
Obj.name = 'Obj';
|
||||
|
||||
function Obj(props, generated) {
|
||||
this.generated = generated != null ? generated : false;
|
||||
this.objects = this.properties = props || [];
|
||||
|
@ -1207,8 +1181,6 @@
|
|||
|
||||
__extends(Arr, _super);
|
||||
|
||||
Arr.name = 'Arr';
|
||||
|
||||
function Arr(objs) {
|
||||
this.objects = objs || [];
|
||||
}
|
||||
|
@ -1263,8 +1235,6 @@
|
|||
|
||||
__extends(Class, _super);
|
||||
|
||||
Class.name = 'Class';
|
||||
|
||||
function Class(variable, parent, body) {
|
||||
this.variable = variable;
|
||||
this.parent = parent;
|
||||
|
@ -1426,9 +1396,6 @@
|
|||
if (!(this.ctor instanceof Code)) {
|
||||
this.body.expressions.unshift(this.ctor);
|
||||
}
|
||||
if (decl) {
|
||||
this.body.expressions.unshift(new Assign(new Value(new Literal(name), [new Access(new Literal('name'))]), new Literal("'" + name + "'")));
|
||||
}
|
||||
this.body.expressions.push(lname);
|
||||
(_ref2 = this.body.expressions).unshift.apply(_ref2, this.directives);
|
||||
this.addBoundFunctions(o);
|
||||
|
@ -1455,8 +1422,6 @@
|
|||
|
||||
__extends(Assign, _super);
|
||||
|
||||
Assign.name = 'Assign';
|
||||
|
||||
function Assign(variable, value, context, options) {
|
||||
var forbidden, name, _ref2;
|
||||
this.variable = variable;
|
||||
|
@ -1677,8 +1642,6 @@
|
|||
|
||||
__extends(Code, _super);
|
||||
|
||||
Code.name = 'Code';
|
||||
|
||||
function Code(params, body, tag) {
|
||||
this.params = params || [];
|
||||
this.body = body || new Block;
|
||||
|
@ -1835,8 +1798,6 @@
|
|||
|
||||
__extends(Param, _super);
|
||||
|
||||
Param.name = 'Param';
|
||||
|
||||
function Param(name, value, splat) {
|
||||
var _ref2;
|
||||
this.name = name;
|
||||
|
@ -1923,8 +1884,6 @@
|
|||
|
||||
__extends(Splat, _super);
|
||||
|
||||
Splat.name = 'Splat';
|
||||
|
||||
Splat.prototype.children = ['name'];
|
||||
|
||||
Splat.prototype.isAssignable = YES;
|
||||
|
@ -1995,8 +1954,6 @@
|
|||
|
||||
__extends(While, _super);
|
||||
|
||||
While.name = 'While';
|
||||
|
||||
function While(condition, options) {
|
||||
this.condition = (options != null ? options.invert : void 0) ? condition.invert() : condition;
|
||||
this.guard = options != null ? options.guard : void 0;
|
||||
|
@ -2078,8 +2035,6 @@
|
|||
|
||||
__extends(Op, _super);
|
||||
|
||||
Op.name = 'Op';
|
||||
|
||||
function Op(op, first, second, flip) {
|
||||
if (op === 'in') {
|
||||
return new In(first, second);
|
||||
|
@ -2272,8 +2227,6 @@
|
|||
|
||||
__extends(In, _super);
|
||||
|
||||
In.name = 'In';
|
||||
|
||||
function In(object, array) {
|
||||
this.object = object;
|
||||
this.array = array;
|
||||
|
@ -2354,8 +2307,6 @@
|
|||
|
||||
__extends(Try, _super);
|
||||
|
||||
Try.name = 'Try';
|
||||
|
||||
function Try(attempt, error, recovery, ensure) {
|
||||
this.attempt = attempt;
|
||||
this.error = error;
|
||||
|
@ -2413,8 +2364,6 @@
|
|||
|
||||
__extends(Throw, _super);
|
||||
|
||||
Throw.name = 'Throw';
|
||||
|
||||
function Throw(expression) {
|
||||
this.expression = expression;
|
||||
}
|
||||
|
@ -2439,8 +2388,6 @@
|
|||
|
||||
__extends(Existence, _super);
|
||||
|
||||
Existence.name = 'Existence';
|
||||
|
||||
function Existence(expression) {
|
||||
this.expression = expression;
|
||||
}
|
||||
|
@ -2474,8 +2421,6 @@
|
|||
|
||||
__extends(Parens, _super);
|
||||
|
||||
Parens.name = 'Parens';
|
||||
|
||||
function Parens(body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
@ -2514,8 +2459,6 @@
|
|||
|
||||
__extends(For, _super);
|
||||
|
||||
For.name = 'For';
|
||||
|
||||
function For(body, source) {
|
||||
var _ref2;
|
||||
this.source = source.source, this.guard = source.guard, this.step = source.step, this.name = source.name, this.index = source.index;
|
||||
|
@ -2673,8 +2616,6 @@
|
|||
|
||||
__extends(Switch, _super);
|
||||
|
||||
Switch.name = 'Switch';
|
||||
|
||||
function Switch(subject, cases, otherwise) {
|
||||
this.subject = subject;
|
||||
this.cases = cases;
|
||||
|
@ -2760,8 +2701,6 @@
|
|||
|
||||
__extends(If, _super);
|
||||
|
||||
If.name = 'If';
|
||||
|
||||
function If(condition, body, options) {
|
||||
this.body = body;
|
||||
if (options == null) {
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
exports.OptionParser = OptionParser = (function() {
|
||||
|
||||
OptionParser.name = 'OptionParser';
|
||||
|
||||
function OptionParser(rules, banner) {
|
||||
this.banner = banner;
|
||||
this.rules = buildRules(rules);
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
exports.Rewriter = (function() {
|
||||
|
||||
Rewriter.name = 'Rewriter';
|
||||
|
||||
function Rewriter() {}
|
||||
|
||||
Rewriter.prototype.rewrite = function(tokens) {
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
exports.Scope = Scope = (function() {
|
||||
|
||||
Scope.name = 'Scope';
|
||||
|
||||
Scope.root = null;
|
||||
|
||||
function Scope(parent, expressions, method) {
|
||||
|
|
|
@ -966,8 +966,6 @@ exports.Class = class Class extends Base
|
|||
@ensureConstructor name
|
||||
@body.spaced = yes
|
||||
@body.expressions.unshift @ctor unless @ctor instanceof Code
|
||||
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.unshift @directives...
|
||||
@addBoundFunctions o
|
||||
|
|
Loading…
Add table
Reference in a new issue