Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use non-reserved word for name of arguments variable

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...
commit cf023b0461557c57999987de0d3789aeadbdb0d8 1 parent 3d1d9d7
@jannon jannon authored
Showing with 7 additions and 7 deletions.
  1. +7 −7 jsdoc.js
View
14 jsdoc.js
@@ -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);
}
}
}
@@ -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),
/**
Please sign in to comment.
Something went wrong with that request. Please try again.