mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-04-11 03:00:13 -04:00
nodes: removed o.chainRoot which went unused
This commit is contained in:
13
lib/nodes.js
13
lib/nodes.js
@@ -28,9 +28,6 @@
|
|||||||
var closure, code, top;
|
var closure, code, top;
|
||||||
this.options = o ? merge(o) : {};
|
this.options = o ? merge(o) : {};
|
||||||
this.tab = o.indent;
|
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');
|
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();
|
closure = this.isStatement(o) && !this.isPureStatement() && !top && !this.options.asStatement && !(this instanceof CommentNode) && !this.containsPureStatement();
|
||||||
if (!o.keepLevel) {
|
if (!o.keepLevel) {
|
||||||
@@ -374,7 +371,6 @@
|
|||||||
return ex.compile(o);
|
return ex.compile(o);
|
||||||
}
|
}
|
||||||
props = this.properties;
|
props = this.properties;
|
||||||
o.chainRoot || (o.chainRoot = this);
|
|
||||||
if (this.parenthetical && !props.length) {
|
if (this.parenthetical && !props.length) {
|
||||||
this.base.parenthetical = true;
|
this.base.parenthetical = true;
|
||||||
}
|
}
|
||||||
@@ -520,7 +516,6 @@
|
|||||||
if (node = this.unfoldSoak(o)) {
|
if (node = this.unfoldSoak(o)) {
|
||||||
return node.compile(o);
|
return node.compile(o);
|
||||||
}
|
}
|
||||||
o.chainRoot || (o.chainRoot = this);
|
|
||||||
if (this.exist) {
|
if (this.exist) {
|
||||||
if (val = this.variable) {
|
if (val = this.variable) {
|
||||||
if (!(val instanceof ValueNode)) {
|
if (!(val instanceof ValueNode)) {
|
||||||
@@ -626,9 +621,8 @@
|
|||||||
AccessorNode.prototype["class"] = 'AccessorNode';
|
AccessorNode.prototype["class"] = 'AccessorNode';
|
||||||
AccessorNode.prototype.children = ['name'];
|
AccessorNode.prototype.children = ['name'];
|
||||||
AccessorNode.prototype.compileNode = function(o) {
|
AccessorNode.prototype.compileNode = function(o) {
|
||||||
var _base, name, namePart;
|
var name, namePart;
|
||||||
name = this.name.compile(o);
|
name = this.name.compile(o);
|
||||||
(_base = o.chainRoot).wrapped || (_base.wrapped = this.soakNode);
|
|
||||||
namePart = name.match(IS_STRING) ? ("[" + (name) + "]") : ("." + (name));
|
namePart = name.match(IS_STRING) ? ("[" + (name) + "]") : ("." + (name));
|
||||||
return this.prototype + namePart;
|
return this.prototype + namePart;
|
||||||
};
|
};
|
||||||
@@ -645,8 +639,7 @@
|
|||||||
IndexNode.prototype["class"] = 'IndexNode';
|
IndexNode.prototype["class"] = 'IndexNode';
|
||||||
IndexNode.prototype.children = ['index'];
|
IndexNode.prototype.children = ['index'];
|
||||||
IndexNode.prototype.compileNode = function(o) {
|
IndexNode.prototype.compileNode = function(o) {
|
||||||
var _base, idx, prefix;
|
var idx, prefix;
|
||||||
(_base = o.chainRoot).wrapped || (_base.wrapped = this.soakNode);
|
|
||||||
idx = this.index.compile(o);
|
idx = this.index.compile(o);
|
||||||
prefix = this.proto ? '.prototype' : '';
|
prefix = this.proto ? '.prototype' : '';
|
||||||
return "" + (prefix) + "[" + (idx) + "]";
|
return "" + (prefix) + "[" + (idx) + "]";
|
||||||
@@ -1906,7 +1899,7 @@
|
|||||||
};
|
};
|
||||||
TAB = ' ';
|
TAB = ' ';
|
||||||
TRAILING_WHITESPACE = /[ \t]+$/gm;
|
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;
|
NUMBER = /^0x[\da-f]+|^(?:\d+(\.\d+)?|\.\d+)(?:e[+-]?\d+)?$/i;
|
||||||
SIMPLENUM = /^-?\d+$/;
|
SIMPLENUM = /^-?\d+$/;
|
||||||
IS_STRING = /^['"]/;
|
IS_STRING = /^['"]/;
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ exports.BaseNode = class BaseNode
|
|||||||
compile: (o) ->
|
compile: (o) ->
|
||||||
@options = if o then merge o else {}
|
@options = if o then merge o else {}
|
||||||
@tab = o.indent
|
@tab = o.indent
|
||||||
del @options, 'chainRoot' unless this instanceof AccessorNode or this instanceof IndexNode
|
|
||||||
top = if @topSensitive() then @options.top else del @options, 'top'
|
top = if @topSensitive() then @options.top else del @options, 'top'
|
||||||
closure = @isStatement(o) and not @isPureStatement() and not top and
|
closure = @isStatement(o) and not @isPureStatement() and not top and
|
||||||
not @options.asStatement and this not instanceof CommentNode and
|
not @options.asStatement and this not instanceof CommentNode and
|
||||||
@@ -367,7 +366,6 @@ exports.ValueNode = class ValueNode extends BaseNode
|
|||||||
compileNode: (o) ->
|
compileNode: (o) ->
|
||||||
return ex.compile o if ex = @unfoldSoak o
|
return ex.compile o if ex = @unfoldSoak o
|
||||||
props = @properties
|
props = @properties
|
||||||
o.chainRoot or= this
|
|
||||||
@base.parenthetical = yes if @parenthetical and not props.length
|
@base.parenthetical = yes if @parenthetical and not props.length
|
||||||
code = @base.compile o
|
code = @base.compile o
|
||||||
if props[0] instanceof AccessorNode and @isNumber() or
|
if props[0] instanceof AccessorNode and @isNumber() or
|
||||||
@@ -484,7 +482,6 @@ exports.CallNode = class CallNode extends BaseNode
|
|||||||
# Compile a vanilla function call.
|
# Compile a vanilla function call.
|
||||||
compileNode: (o) ->
|
compileNode: (o) ->
|
||||||
return node.compile o if node = @unfoldSoak o
|
return node.compile o if node = @unfoldSoak o
|
||||||
o.chainRoot or= this
|
|
||||||
if @exist
|
if @exist
|
||||||
if val = @variable
|
if val = @variable
|
||||||
val = new ValueNode val unless val instanceof ValueNode
|
val = new ValueNode val unless val instanceof ValueNode
|
||||||
@@ -576,7 +573,6 @@ exports.AccessorNode = class AccessorNode extends BaseNode
|
|||||||
|
|
||||||
compileNode: (o) ->
|
compileNode: (o) ->
|
||||||
name = @name.compile o
|
name = @name.compile o
|
||||||
o.chainRoot.wrapped or= @soakNode
|
|
||||||
namePart = if name.match(IS_STRING) then "[#{name}]" else ".#{name}"
|
namePart = if name.match(IS_STRING) then "[#{name}]" else ".#{name}"
|
||||||
@prototype + namePart
|
@prototype + namePart
|
||||||
|
|
||||||
@@ -594,7 +590,6 @@ exports.IndexNode = class IndexNode extends BaseNode
|
|||||||
super()
|
super()
|
||||||
|
|
||||||
compileNode: (o) ->
|
compileNode: (o) ->
|
||||||
o.chainRoot.wrapped or= @soakNode
|
|
||||||
idx = @index.compile o
|
idx = @index.compile o
|
||||||
prefix = if @proto then '.prototype' else ''
|
prefix = if @proto then '.prototype' else ''
|
||||||
"#{prefix}[#{idx}]"
|
"#{prefix}[#{idx}]"
|
||||||
@@ -1676,9 +1671,9 @@ TAB = ' '
|
|||||||
# with Git.
|
# with Git.
|
||||||
TRAILING_WHITESPACE = /[ \t]+$/gm
|
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
|
NUMBER = /^0x[\da-f]+|^(?:\d+(\.\d+)?|\.\d+)(?:e[+-]?\d+)?$/i
|
||||||
SIMPLENUM = /^-?\d+$/
|
SIMPLENUM = /^-?\d+$/
|
||||||
|
|
||||||
# Is a literal value a string?
|
# Is a literal value a string?
|
||||||
IS_STRING = /^['"]/
|
IS_STRING = /^['"]/
|
||||||
|
|||||||
Reference in New Issue
Block a user