caller and callee properties should not be accessed on arguments object for strict mode function

  • STRICT_MODE_ARGS_CALLER_CALLEE
  • Error
  • High
  • No tags

This rule applies when caller and callee properties are accessed on arguments object allocated for calling strict mode function.

Because arguments.caller and arguments.callee make several code optimizations impossible, they were deprecated and the use of both throws a TypeError exception for strict mode function.

It also applies to the function's caller and arguments properties. (See 'STRICT_MODE_FUNC_PROPERTY' rule)

Noncompliant Code Example

View with compliant examples side by side
setTimeout(function () {
    'use strict';
    setTimeout(arguments.callee, 100); // STRICT_MODE_ARGS_CALLER_CALLEE alarm
}, 100);

Compliant Code Example

View with noncompliant examples side by side
function callback() {
    'use strict';
    setTimeout(callback, 100);
}
setTimeout(callback, 100);

Version

This rule was introduced in DeepScan 1.0.0-alpha.

See

Was this documentation helpful?