Created
October 15, 2012 07:03
-
-
Save junosuarez/3891149 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| macro module { | |
| case $body => { | |
| define(function (require, exports, module) { | |
| $body | |
| }); | |
| } | |
| } | |
| module { | |
| var x = require('x'); | |
| exports = function foo() { | |
| return 'foo' + x | |
| } | |
| } | |
| // outputs: | |
| define(function (require$1, exports$2, module$3) { | |
| { | |
| var x$6 = require('x'); | |
| exports = function foo() { | |
| return 'foo' + x$6; | |
| }; | |
| } | |
| }); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note,
exports$2does not match the reference toexportsin the function body (line 21) - same withrequire$1andrequire(line 20). It's fine to sanitize symbols, but you gotta be consistent in scope.