Skip to content

Commit 0199515

Browse files
committed
experimental change -- comments wanted. writing out helper functions and assignments as a single line, to minimize clutter.
1 parent 37705e7 commit 0199515

File tree

4 files changed

+7
-41
lines changed

4 files changed

+7
-41
lines changed

lib/coffee-script/lexer.js

+1-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/coffee-script/nodes.js

+3-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/coffee-script/rewriter.js

+1-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/nodes.coffee

+2-14
Original file line numberDiff line numberDiff line change
@@ -1801,14 +1801,7 @@ UTILITIES =
18011801
# Correctly set up a prototype chain for inheritance, including a reference
18021802
# to the superclass for `super()` calls, and copies of any static properties.
18031803
extends: -> """
1804-
function(child, parent) {
1805-
for (var key in parent) { if (#{utility 'hasProp'}.call(parent, key)) child[key] = parent[key]; }
1806-
function ctor() { this.constructor = child; }
1807-
ctor.prototype = parent.prototype;
1808-
child.prototype = new ctor;
1809-
child.__super__ = parent.prototype;
1810-
return child;
1811-
}
1804+
function(child, parent) { for (var key in parent) { if (#{utility 'hasProp'}.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }
18121805
"""
18131806

18141807
# Create a function bound to the current value of "this".
@@ -1818,12 +1811,7 @@ UTILITIES =
18181811

18191812
# Discover if an item is in an array.
18201813
indexOf: -> """
1821-
Array.prototype.indexOf || function(item) {
1822-
for (var i = 0, l = this.length; i < l; i++) {
1823-
if (#{utility 'hasProp'}.call(this, i) && this[i] === item) return i;
1824-
}
1825-
return -1;
1826-
}
1814+
Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (#{utility 'hasProp'}.call(this, i) && this[i] === item) return i; } return -1; }
18271815
"""
18281816

18291817
# Shortcuts to speed up the lookup time for native functions.

0 commit comments

Comments
 (0)