nodes: removed `o.chainRoot` which went unused

This commit is contained in:
satyr 2010-10-02 08:33:57 +09:00
parent 8cdee9c0f4
commit 4fd878447e
2 changed files with 5 additions and 17 deletions

View File

@ -28,9 +28,6 @@
var closure, code, top;
this.options = o ? merge(o) : {};
this.tab = o.indent;
if (!(this instanceof AccessorNode || this instanceof IndexNode)) {
del(this.options, 'chainRoot');
}
top = this.topSensitive() ? this.options.top : del(this.options, 'top');
closure = this.isStatement(o) && !this.isPureStatement() && !top && !this.options.asStatement && !(this instanceof CommentNode) && !this.containsPureStatement();
if (!o.keepLevel) {
@ -374,7 +371,6 @@
return ex.compile(o);
}
props = this.properties;
o.chainRoot || (o.chainRoot = this);
if (this.parenthetical && !props.length) {
this.base.parenthetical = true;
}
@ -520,7 +516,6 @@
if (node = this.unfoldSoak(o)) {
return node.compile(o);
}
o.chainRoot || (o.chainRoot = this);
if (this.exist) {
if (val = this.variable) {
if (!(val instanceof ValueNode)) {
@ -626,9 +621,8 @@
AccessorNode.prototype["class"] = 'AccessorNode';
AccessorNode.prototype.children = ['name'];
AccessorNode.prototype.compileNode = function(o) {
var _base, name, namePart;
var name, namePart;
name = this.name.compile(o);
(_base = o.chainRoot).wrapped || (_base.wrapped = this.soakNode);
namePart = name.match(IS_STRING) ? ("[" + (name) + "]") : ("." + (name));
return this.prototype + namePart;
};
@ -645,8 +639,7 @@
IndexNode.prototype["class"] = 'IndexNode';
IndexNode.prototype.children = ['index'];
IndexNode.prototype.compileNode = function(o) {
var _base, idx, prefix;
(_base = o.chainRoot).wrapped || (_base.wrapped = this.soakNode);
var idx, prefix;
idx = this.index.compile(o);
prefix = this.proto ? '.prototype' : '';
return "" + (prefix) + "[" + (idx) + "]";
@ -1906,7 +1899,7 @@
};
TAB = ' ';
TRAILING_WHITESPACE = /[ \t]+$/gm;
IDENTIFIER = /^[$A-Za-zA-Z_][$\w]*$/;
IDENTIFIER = /^[$A-Za-z_][$\w]*$/;
NUMBER = /^0x[\da-f]+|^(?:\d+(\.\d+)?|\.\d+)(?:e[+-]?\d+)?$/i;
SIMPLENUM = /^-?\d+$/;
IS_STRING = /^['"]/;

View File

@ -42,7 +42,6 @@ exports.BaseNode = class BaseNode
compile: (o) ->
@options = if o then merge o else {}
@tab = o.indent
del @options, 'chainRoot' unless this instanceof AccessorNode or this instanceof IndexNode
top = if @topSensitive() then @options.top else del @options, 'top'
closure = @isStatement(o) and not @isPureStatement() and not top and
not @options.asStatement and this not instanceof CommentNode and
@ -367,7 +366,6 @@ exports.ValueNode = class ValueNode extends BaseNode
compileNode: (o) ->
return ex.compile o if ex = @unfoldSoak o
props = @properties
o.chainRoot or= this
@base.parenthetical = yes if @parenthetical and not props.length
code = @base.compile o
if props[0] instanceof AccessorNode and @isNumber() or
@ -484,7 +482,6 @@ exports.CallNode = class CallNode extends BaseNode
# Compile a vanilla function call.
compileNode: (o) ->
return node.compile o if node = @unfoldSoak o
o.chainRoot or= this
if @exist
if val = @variable
val = new ValueNode val unless val instanceof ValueNode
@ -576,7 +573,6 @@ exports.AccessorNode = class AccessorNode extends BaseNode
compileNode: (o) ->
name = @name.compile o
o.chainRoot.wrapped or= @soakNode
namePart = if name.match(IS_STRING) then "[#{name}]" else ".#{name}"
@prototype + namePart
@ -594,7 +590,6 @@ exports.IndexNode = class IndexNode extends BaseNode
super()
compileNode: (o) ->
o.chainRoot.wrapped or= @soakNode
idx = @index.compile o
prefix = if @proto then '.prototype' else ''
"#{prefix}[#{idx}]"
@ -1676,7 +1671,7 @@ TAB = ' '
# with Git.
TRAILING_WHITESPACE = /[ \t]+$/gm
IDENTIFIER = /^[$A-Za-zA-Z_][$\w]*$/
IDENTIFIER = /^[$A-Za-z_][$\w]*$/
NUMBER = /^0x[\da-f]+|^(?:\d+(\.\d+)?|\.\d+)(?:e[+-]?\d+)?$/i
SIMPLENUM = /^-?\d+$/