想知道 qooxdoo 语法/解析

发布于 2024-12-10 00:55:04 字数 240 浏览 3 评论 0原文

我在我的代码中发现了两行。

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

遮云壑 2024-12-17 00:55:04

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文