想知道 qooxdoo 语法/解析
我在我的代码中发现了两行。
test = new qx.ui.form.RadioGroup;
我想知道,缺少的 () 是否可能会导致问题,或者是否应该在生成器或 lint 作业中发出警告。
qx.ui.form.RadioGroup;
我认为可能值得在 lint 中将其报告为“无效果的声明”。
I found two lines in my code.
test = new qx.ui.form.RadioGroup;
I am wondering, if the missing () might cause issues or should maybe raise a warning in the generator or the lint job.
qx.ui.form.RadioGroup;
I think it might be worth reporting it as a "statement without effect" in lint.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
mck89 的评论就是答案(我想知道为什么这么多人在评论中添加有效答案...):
您不需要括号,并且
new qx.ui.form.RadioGroup
在语法上是正确的表达式,相当于添加一对空括号。 (有一些检查器会对此发出警告,就像我相信 JsLint,但 qooxdoo 不会......:)。在您的特定情况下,代码也将在浏览器中成功运行,因为 RadioGroup 允许空构造函数参数;您可以稍后使用
.add()
将项目添加到组中。mck89's comment is the answer (I wonder why so many people put valid answers in comments...):
You don't need the parens, and
new qx.ui.form.RadioGroup
is a syntactically correct expression, equivalent to adding a pair of empty parens. (There are some checkers that will warn about this, like I believe JsLint, but qooxdoo doesn't ... :).In your particular case, the code will also run successfully in the browser, as RadioGroup permits empty constructor args; you can use
.add()
later to add items to the group.