Parenthetical -> Parens

This commit is contained in:
satyr
2010-10-07 12:53:26 +09:00
parent 2d9cff3af6
commit 250ec12646
5 changed files with 44 additions and 44 deletions

View File

@@ -1,5 +1,5 @@
(function() {
var Accessor, ArrayLiteral, Assign, Base, Call, Class, Closure, Code, Comment, Existence, Expressions, Extends, For, IDENTIFIER, IS_STRING, If, In, Index, Literal, NO, NUMBER, ObjectLiteral, Op, Param, Parenthetical, Push, Range, Return, SIMPLENUM, Scope, Slice, Splat, Switch, TAB, THIS, TRAILING_WHITESPACE, Throw, Try, UTILITIES, Value, While, YES, _ref, compact, del, ends, flatten, include, indexOf, last, merge, starts, utility;
var Accessor, ArrayLiteral, Assign, Base, Call, Class, Closure, Code, Comment, Existence, Expressions, Extends, For, IDENTIFIER, IS_STRING, If, In, Index, Literal, NO, NUMBER, ObjectLiteral, Op, Param, Parens, Push, Range, Return, SIMPLENUM, Scope, Slice, Splat, Switch, TAB, THIS, TRAILING_WHITESPACE, Throw, Try, UTILITIES, Value, While, YES, _ref, compact, del, ends, flatten, include, indexOf, last, merge, starts, utility;
var __extends = function(child, parent) {
var ctor = function() {};
ctor.prototype = parent.prototype;
@@ -360,7 +360,7 @@
base = new Value(this.base, this.properties.slice(0, -1));
if (base.isComplex()) {
bref = new Literal(o.scope.freeVariable('base'));
base = new Value(new Parenthetical(new Assign(bref, base)));
base = new Value(new Parens(new Assign(bref, base)));
}
if (!(name)) {
return [base, bref];
@@ -408,7 +408,7 @@
snd = new Value(this.base, this.properties.slice(i));
if (fst.isComplex()) {
ref = new Literal(o.scope.freeVariable('ref'));
fst = new Parenthetical(new Assign(ref, fst));
fst = new Parens(new Assign(ref, fst));
snd.base = ref;
}
ifn = new If(new Existence(fst), snd, {
@@ -1272,7 +1272,7 @@
While.__super__.constructor.call(this);
if (((opts != null) ? opts.invert : undefined)) {
if (condition instanceof Op) {
condition = new Parenthetical(condition);
condition = new Parens(condition);
}
condition = new Op('!', condition);
}
@@ -1333,7 +1333,7 @@
this.operator = this.CONVERSIONS[this.operator] || this.operator;
this.flip = !!flip;
if (this.first instanceof Value && this.first.base instanceof ObjectLiteral) {
this.first = new Parenthetical(this.first);
this.first = new Parens(this.first);
} else if (this.operator === 'new' && this.first instanceof Call) {
return this.first.newInstance();
}
@@ -1399,10 +1399,10 @@
return this.compileExistence(o);
}
if (this.first instanceof Op && this.first.isMutator()) {
this.first = new Parenthetical(this.first);
this.first = new Parens(this.first);
}
if (this.second instanceof Op && this.second.isMutator()) {
this.second = new Parenthetical(this.second);
this.second = new Parens(this.second);
}
return [this.first.compile(o), this.operator, this.second.compile(o)].join(' ');
};
@@ -1423,7 +1423,7 @@
var fst, ref;
if (this.first.isComplex()) {
ref = o.scope.freeVariable('ref');
fst = new Parenthetical(new Assign(new Literal(ref), this.first));
fst = new Parens(new Assign(new Literal(ref), this.first));
} else {
fst = this.first;
ref = fst.compile(o);
@@ -1555,27 +1555,27 @@
};
return Existence;
})();
exports.Parenthetical = (function() {
Parenthetical = (function() {
return function Parenthetical(_arg) {
exports.Parens = (function() {
Parens = (function() {
return function Parens(_arg) {
this.expression = _arg;
Parenthetical.__super__.constructor.call(this);
Parens.__super__.constructor.call(this);
return this;
};
})();
__extends(Parenthetical, Base);
Parenthetical.prototype.children = ['expression'];
Parenthetical.prototype.isStatement = function(o) {
__extends(Parens, Base);
Parens.prototype.children = ['expression'];
Parens.prototype.isStatement = function(o) {
return this.expression.isStatement(o);
};
Parenthetical.prototype.isComplex = function() {
Parens.prototype.isComplex = function() {
return this.expression.isComplex();
};
Parenthetical.prototype.topSensitive = YES;
Parenthetical.prototype.makeReturn = function() {
Parens.prototype.topSensitive = YES;
Parens.prototype.makeReturn = function() {
return this.expression.makeReturn();
};
Parenthetical.prototype.compileNode = function(o) {
Parens.prototype.compileNode = function(o) {
var code, top;
top = del(o, 'top');
this.expression.parenthetical = true;
@@ -1588,7 +1588,7 @@
}
return "(" + code + ")";
};
return Parenthetical;
return Parens;
})();
exports.For = (function() {
For = (function() {
@@ -1768,7 +1768,7 @@
for (_j = 0, _len2 = (_ref4 = flatten([conditions])).length; _j < _len2; _j++) {
condition = _ref4[_j];
if (this.tags.subjectless) {
condition = new Op('!!', new Parenthetical(condition));
condition = new Op('!!', new Parens(condition));
}
code += ("\n" + (this.idt(1)) + "case " + (condition.compile(o)) + ":");
}
@@ -1796,7 +1796,7 @@
if (this.condition instanceof Op && this.condition.isInvertible()) {
this.condition.invert();
} else {
this.condition = new Op('!', new Parenthetical(this.condition));
this.condition = new Op('!', new Parens(this.condition));
}
}
this.elseBody = null;
@@ -1904,7 +1904,7 @@
if (expressions.containsPureStatement()) {
return expressions;
}
func = new Parenthetical(new Code([], Expressions.wrap([expressions])));
func = new Parens(new Code([], Expressions.wrap([expressions])));
args = [];
if ((mentionsArgs = expressions.contains(this.literalArgs)) || (expressions.contains(this.literalThis))) {
meth = new Literal(mentionsArgs ? 'apply' : 'call');