Skip to content

Commit

Permalink
parameter_arguments_a
Browse files Browse the repository at this point in the history
  • Loading branch information
douglascrockford committed Feb 17, 2012
1 parent 76f92db commit 68f3eda
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions jslint.js
@@ -1,5 +1,5 @@
// jslint.js
// 2012-02-14
// 2012-02-16

// Copyright (c) 2002 Douglas Crockford (www.JSLint.com)

Expand Down Expand Up @@ -202,8 +202,8 @@
// For example:

/*properties
'\b', '\t', '\n', '\f', '\r', '!=', '!==', '"', '%', '\'', '(begin)',
'(breakage)', '(context)', '(error)', '(identifier)', '(line)',
'\b', '\t', '\n', '\f', '\r', '!=', '!==', '"', '%', '\'', '(arguments)',
'(begin)', '(breakage)', '(context)', '(error)', '(identifier)', '(line)',
'(loopage)', '(name)', '(params)', '(scope)', '(token)', '(vars)',
'(verb)', '*', '+', '-', '/', '<', '<=', '==', '===', '>',
'>=', ADSAFE, Array, Date, E, Function, LN10, LN2, LOG10E, LOG2E,
Expand Down Expand Up @@ -281,9 +281,9 @@
'outline-color', 'outline-style', 'outline-width', output, overflow,
'overflow-x', 'overflow-y', p, padding, 'padding-bottom', 'padding-left',
'padding-right', 'padding-top', 'page-break-after', 'page-break-before',
param, parameter_a_get_b, parameter_set_a, params, paren, parent, parse,
passfail, pc, plusplus, pop, position, postscript, pre, predef,
preventExtensions, print, progress, projection, properties,
param, parameter_a_get_b, parameter_arguments_a, parameter_set_a, params,
paren, parent, parse, passfail, pc, plusplus, pop, position, postscript,
pre, predef, preventExtensions, print, progress, projection, properties,
propertyIsEnumerable, prototype, pt, push, px, q, quote, quotes, r, radix,
range, raw, read_only, reason, redefinition_a, reduce, reduceRight, regexp,
replace, report, reserved, reserved_a, reverse, rhino, right, rp, rt, ruby,
Expand Down Expand Up @@ -564,6 +564,7 @@ var JSLINT = (function () {
not_a_scope: "'{a}' is out of scope.",
not_greater: "'{a}' should not be greater than '{b}'.",
octal_a: "Don't use octal: '{a}'. Use '\\u....' instead.",
parameter_arguments_a: "Do not mutate parameter '{a}' when using 'arguments'.",
parameter_a_get_b: "Unexpected parameter '{a}' in get {b} function.",
parameter_set_a: "Expected parameter (value) in set {a} function.",
radix: "Missing radix parameter.",
Expand Down Expand Up @@ -2786,6 +2787,11 @@ klass: do {
} else {
stop('read_only');
}
funct['(params)'].forEach(function (value) {
if (value.string === left.string) {
value.assign = true;
}
});
} else if (option.safe) {
l = left;
do {
Expand Down Expand Up @@ -3207,6 +3213,7 @@ klass: do {
} else if (option.safe) {
warn('adsafe_a', x);
}
funct['(arguments)'] = true;
});
reservevar('eval', function (x) {
if (option.safe) {
Expand Down Expand Up @@ -3809,7 +3816,7 @@ klass: do {
if (next_token.id === ')') {
no_space();
step_out(')', paren);
return;
return params;
}
for (;;) {
edge();
Expand Down Expand Up @@ -3852,6 +3859,13 @@ klass: do {
func.first = funct['(params)'] = function_params();
one_space();
func.block = block(false);
if (funct['(arguments)']) {
func.first.forEach(function (value) {
if (value.assign) {
warn('parameter_arguments_a', value, value.string);
}
});
}
funct = old_funct;
option = old_option;
scope = old_scope;
Expand Down Expand Up @@ -6387,7 +6401,7 @@ klass: do {
};
itself.jslint = itself;

itself.edition = '2012-02-14';
itself.edition = '2012-02-16';

return itself;
}());

0 comments on commit 68f3eda

Please sign in to comment.