什么是直接参考? [英] What is a direct reference?

查看:115
本文介绍了什么是直接参考?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

严格模式规则之一(附件C )声明:

One of the strict mode rules (Annex C) states:


当在严格模式代码中出现 delete 运算符时, SyntaxError 如果 UnaryExpression 是对变量,函数参数或函数名的直接引用,则抛出它。

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.

所以在这段代码中:

delete x

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?)

推荐答案

是的,有不同种类的参考文献EcmaScript§8.7 )。成员运营商(EcmaScript§11.2.1)例如导致基值 baseReference 的值的引用,我称之为非直接。 直接参考将是标识符参考(EcmaScript§10.2.2.1 ,其中基值是环境记录。

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.

这篇关于什么是直接参考?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆