The moment of truth: CoffeeScript has now compiled itself ten times over.

This commit is contained in:
Jeremy Ashkenas
2010-02-13 01:13:08 -05:00
parent 126f6c2d88
commit b965fcf32d
6 changed files with 24 additions and 35 deletions

View File

@@ -4,7 +4,7 @@ process.mixin require './scope'
# Tabs are two spaces for pretty printing.
TAB: ' '
TRAILING_WHITESPACE: /\s+$/g
TRAILING_WHITESPACE: /\s+$/gm
# Keep the identifier regex in sync with the Lexer.
IDENTIFIER: /^[a-zA-Z$_](\w|\$)*$/
@@ -382,13 +382,13 @@ ExtendsNode: exports.ExtendsNode: inherit Node, {
# Hooking one constructor into another's prototype chain.
compile_node: (o) ->
constructor: o.scope.free_variable()
child: @child.compile(o)
parent: @parent.compile(o)
@idt() + constructor + ' = function(){};\n' + @idt() +
constructor + '.prototype = ' + parent + ".prototype;\n" + @idt() +
construct: o.scope.free_variable()
child: @child.compile(o)
parent: @parent.compile(o)
@idt() + construct + ' = function(){};\n' + @idt() +
construct + '.prototype = ' + parent + ".prototype;\n" + @idt() +
child + '.__superClass__ = ' + parent + ".prototype;\n" + @idt() +
child + '.prototype = new ' + constructor + "();\n" + @idt() +
child + '.prototype = new ' + construct + "();\n" + @idt() +
child + '.prototype.constructor = ' + child + ';'
}