One of the strict mode rules (Annex C) states:
When a
delete
operator occurs within strict mode code, a SyntaxError is thrown 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 it a direct reference?
And, are there other kinds of references? Indirect references? (If not, what's the point of using the word "direct" at all?)
Yes, there are different kinds of References
(EcmaScript §8.7). The member operators (EcmaScript §11.2.1) for example do result in references whose base value is the value of the baseReference
, which I'd call "not direct". A "direct reference" would be an identifier reference (EcmaScript §10.2.2.1, where the base value is an Environment Record.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With