mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-17 11:01:25 -05:00
removing traces of Ruby from coffee-script.coffee, redoing narwhal support to use the new compiler (but untested)
This commit is contained in:
@@ -47,45 +47,3 @@ exports.print_tokens: (tokens) ->
|
||||
strings: for token in tokens
|
||||
'[' + token[0] + ' ' + token[1].toString().replace(/\n/, '\\n') + ']'
|
||||
puts strings.join(' ')
|
||||
|
||||
|
||||
#---------- Below this line is obsolete, for the Ruby compiler. ----------------
|
||||
|
||||
# The path to the CoffeeScript executable.
|
||||
compiler: ->
|
||||
path.normalize(path.dirname(__filename) + '/../../bin/coffee')
|
||||
|
||||
# Compile a string over stdin, with global variables, for the REPL.
|
||||
exports.ruby_compile: (code, callback) ->
|
||||
js: ''
|
||||
coffee: process.createChildProcess compiler(), ['--eval', '--no-wrap', '--globals']
|
||||
|
||||
coffee.addListener 'output', (results) ->
|
||||
js += results if results?
|
||||
|
||||
coffee.addListener 'exit', ->
|
||||
callback(js)
|
||||
|
||||
coffee.write(code)
|
||||
coffee.close()
|
||||
|
||||
|
||||
# Compile a list of CoffeeScript files on disk.
|
||||
exports.ruby_compile_files: (paths, callback) ->
|
||||
js: ''
|
||||
coffee: process.createChildProcess compiler(), ['--print'].concat(paths)
|
||||
|
||||
coffee.addListener 'output', (results) ->
|
||||
js += results if results?
|
||||
|
||||
# NB: we have to add a mutex to make sure it doesn't get called twice.
|
||||
exit_ran: false
|
||||
coffee.addListener 'exit', ->
|
||||
return if exit_ran
|
||||
exit_ran: true
|
||||
callback(js)
|
||||
|
||||
coffee.addListener 'error', (message) ->
|
||||
return unless message
|
||||
puts message
|
||||
throw new Error "CoffeeScript compile error"
|
||||
|
||||
Reference in New Issue
Block a user