33 lines
1.0 KiB
Plaintext
33 lines
1.0 KiB
Plaintext
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
|
|
|
|
----
|
|
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[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|