Skip to content

Commit

Permalink
Use non-reserved word for name of arguments variable
Browse files Browse the repository at this point in the history
The jsdoc.js file is processed twice for some reason when executing from the jsdoc3 ant task (github.com/jannon/jsdoc3-ant-task), but the arguments variable remains the same so the second pass is missing the "dirname option that was spliced out the first time.  Trouble ensues.

Although the root cause of that is unknown, there's no reason not to just be safe and name the variable something else.  Now, during the second pass, the arguments retains it's original value.
  • Loading branch information
jannon committed Mar 16, 2012
1 parent 3d1d9d7 commit cf023b0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions jsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
@global
*/
__dirname = '.',
arguments = Array.prototype.slice.call(arguments, 0);
args = Array.prototype.slice.call(arguments, 0);

// rhino has no native way to get the base dirname of the currently running script
// so this information must be manually passed in from the command line
for (var i = 0; i < arguments.length; i++) {
if ( /^--dirname(?:=(.+?)(\/|\/\.)?)?$/i.test(arguments[i]) ) {
for (var i = 0; i < args.length; i++) {
if ( /^--dirname(?:=(.+?)(\/|\/\.)?)?$/i.test(args[i]) ) {
if (RegExp.$1) {
__dirname = RegExp.$1; // last wins
arguments.splice(i--, 1); // remove --dirname opt from arguments
args.splice(i--, 1); // remove --dirname opt from arguments
}
else {
__dirname = arguments[i + 1];
arguments.splice(i--, 2);
__dirname = args[i + 1];
args.splice(i--, 2);
}
}
}
Expand All @@ -49,7 +49,7 @@ env = {
The command line arguments passed into jsdoc.
@type Array
*/
args: Array.prototype.slice.call(arguments, 0),
args: Array.prototype.slice.call(args, 0),


/**
Expand Down

0 comments on commit cf023b0

Please sign in to comment.