Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[建议]支持null-safety引用变量 #608

Open
HasonHuang opened this issue Jan 8, 2024 · 2 comments
Open

[建议]支持null-safety引用变量 #608

HasonHuang opened this issue Jan 8, 2024 · 2 comments
Assignees

Comments

@HasonHuang
Copy link

版本:5.4.1
建议:支持 Null-Safety 引用变量。

例如:a 为 null 时不会抛出空指针。

a?.b

2022-11 有小伙伴已经建议过。

image
@killme2008
Copy link
Owner

嗯,可以下个大版本支持下,看我春节有没有时间

@killme2008 killme2008 self-assigned this Jan 11, 2024
@deific
Copy link

deific commented Jan 22, 2024

这种写法也就是js中的可选链运算符(?.),建议实现是也实现空值合并运算符,也就是最后可??后跟一个默认值。如:let a= b?.c.d?.e ?? 10; 如果b或d或e不存在时,返回默认值10。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants