mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-19 03:44:23 -05:00
fixed the bin/cs repl to save assignment between commands by using the new --no-wrap
This commit is contained in:
@@ -32,7 +32,7 @@ exports.run = function(args) {
|
|||||||
var coffeePath = FILE.path(module.path).dirname().dirname().join("bin", "coffee-script");
|
var coffeePath = FILE.path(module.path).dirname().dirname().join("bin", "coffee-script");
|
||||||
|
|
||||||
exports.compileFile = function(path) {
|
exports.compileFile = function(path) {
|
||||||
var coffee = OS.popen([coffeePath, "--print", path]);
|
var coffee = OS.popen([coffeePath, "--print", "--no-wrap", path]);
|
||||||
|
|
||||||
if (coffee.wait() !== 0)
|
if (coffee.wait() !== 0)
|
||||||
throw new Error("coffee compiler error");
|
throw new Error("coffee compiler error");
|
||||||
@@ -41,7 +41,7 @@ exports.compileFile = function(path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
exports.compile = function(source) {
|
exports.compile = function(source) {
|
||||||
var coffee = OS.popen([coffeePath, "-e"]);
|
var coffee = OS.popen([coffeePath, "--eval", "--no-wrap"]);
|
||||||
|
|
||||||
coffee.stdin.write(source).flush().close();
|
coffee.stdin.write(source).flush().close();
|
||||||
|
|
||||||
@@ -58,10 +58,6 @@ exports.cs_eval = function(source) {
|
|||||||
|
|
||||||
var code = exports.compile(source);
|
var code = exports.compile(source);
|
||||||
|
|
||||||
// strip the function wrapper, we add our own.
|
|
||||||
// TODO: this is very fragile
|
|
||||||
code = code.split("\n").slice(1,-2).join("\n");
|
|
||||||
|
|
||||||
return eval(code);
|
return eval(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,10 +66,6 @@ exports.make_narwhal_factory = function(path) {
|
|||||||
|
|
||||||
var code = exports.compileFile(path);
|
var code = exports.compileFile(path);
|
||||||
|
|
||||||
// strip the function wrapper, we add our own.
|
|
||||||
// TODO: this is very fragile
|
|
||||||
code = code.split("\n").slice(1,-2).join("\n");
|
|
||||||
|
|
||||||
var factoryText = "function(require,exports,module,system,print){" + code + "/**/\n}";
|
var factoryText = "function(require,exports,module,system,print){" + code + "/**/\n}";
|
||||||
|
|
||||||
if (system.engine === "rhino")
|
if (system.engine === "rhino")
|
||||||
|
|||||||
Reference in New Issue
Block a user