From 4ebaa8256314ea29a796bc0676486f7ed698ea73 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Fri, 19 Mar 2010 23:15:42 -0400 Subject: [PATCH] removing the CoffeeScript.run named function from eval'd script scope by making it anonymous --- lib/coffee-script.js | 4 ++-- src/coffee-script.coffee | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/coffee-script.js b/lib/coffee-script.js index 6d5b4f61..901ef95a 100644 --- a/lib/coffee-script.js +++ b/lib/coffee-script.js @@ -51,12 +51,12 @@ }; // Compile and execute a string of CoffeeScript (on the server), correctly // setting `__filename`, `__dirname`, and relative `require()`. - exports.run = function run(code, options) { + exports.run = (function(code, options) { var __dirname, __filename; module.filename = (__filename = options.source); __dirname = path.dirname(__filename); return eval(exports.compile(code, options)); - }; + }); // Extend CoffeeScript with a custom language extension. It should hook in to // the **Lexer** (as a peer of any of the lexer's tokenizing methods), and // push a token on to the stack that contains a **Node** as the value (as a diff --git a/src/coffee-script.coffee b/src/coffee-script.coffee index 6dc59651..f71c4295 100644 --- a/src/coffee-script.coffee +++ b/src/coffee-script.coffee @@ -49,10 +49,11 @@ exports.nodes: (code) -> # Compile and execute a string of CoffeeScript (on the server), correctly # setting `__filename`, `__dirname`, and relative `require()`. -exports.run: (code, options) -> +exports.run: ((code, options) -> module.filename: __filename: options.source __dirname: path.dirname __filename eval exports.compile code, options +) # Extend CoffeeScript with a custom language extension. It should hook in to # the **Lexer** (as a peer of any of the lexer's tokenizing methods), and