
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
50 lines
1.4 KiB
Plaintext
50 lines
1.4 KiB
Plaintext
== Why is this an issue?
|
|
|
|
Both ``++arguments.caller++`` and ``++arguments.callee++`` make quite a few optimizations impossible so they were deprecated in latest versions of JavaScript. In fact, EcmaScript 5 forbids the use of both in ``++strict++`` mode, according to the docs:
|
|
|
|
____
|
|
Arguments objects for strict mode functions define non-configurable accessor properties named "caller" and "callee" which throw a TypeError exception on access.
|
|
____
|
|
|
|
|
|
The same restriction applies to the function's ``++caller++`` and ``++arguments++`` properties in ``++strict++`` mode.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,javascript]
|
|
----
|
|
function whoCalled() {
|
|
if (arguments.caller == null) //Noncompliant
|
|
console.log('I was called from the global scope.');
|
|
else
|
|
console.log(arguments.caller + ' called me!'); // Noncompliant
|
|
|
|
console.log(whoCalled.caller); // Noncompliant
|
|
console.log(whoCalled.arguments); // Noncompliant
|
|
}
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
* Name the enclosing function instead of using the deprecated property "arguments.callee".
|
|
* Remove this use of ["XXX"|arguments].caller".
|
|
* Remove this use of "XXX".arguments".
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 10 Mar 2015, 16:02:18 Ann Campbell wrote:
|
|
origin: JSHint & \http://jira.codehaus.org/browse/SONARJS-92
|
|
|
|
endif::env-github,rspecator-view[]
|