What is a direct link?

One of the strict regime rules ( Appendix C ) states:

When the delete operator occurs in strict mode code, a SyntaxError is raised if its UnaryExpression is a direct reference to a variable, function argument, or function name.

So in this code:

 delete x 

x is a reference. (I know this because "the result of evaluating an identifier is always a value of type Reference" ). But is this a direct link?

And are there any other links? Indirect links? (If not, what's the point of using the word "direct" in general?)

+7
source share
2 answers

Yes, there are different types of References ( EcmaScript §8.7 ). Member statements ( EcmaScript §11.2.1 ), for example, lead to links whose base value is the value of baseReference , which I’d ​​call is not direct. A “direct reference” would be an identifier reference ( EcmaScript §10.2.2.1 , where the base value is an environment record.

+1
source

Everything that is not defined as a property, if I understand it correctly.

They should cause errors or failures in the console:

 (function(){ 'use strict'; var x = '2'; delete x; })(); (function(){ 'use strict'; delete arguments[0]; })('2'); 
0
source

All Articles