-
-
Notifications
You must be signed in to change notification settings - Fork 295
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
Support chained Dart method/prop calls #2228
Comments
In normal Clojure(Script) you can write this as:
Why does ClojureDart need to deviate from this? |
Those are not separate methods, but named parameters to the EdgeInsets constructor https://api.flutter.dev/flutter/painting/EdgeInsets/EdgeInsets.symmetric.html |
For example ;; :require ["package:flutter/material.dart" :as m]
(=
(m/WidgetsBinding.instance.removeObserver some-observer)
(.removeObserver (.-instance m/WidgetsBinding) some-observer)
(-> m/WidgetsBinding .-instance (.removeObserver some-observer))) |
I understand those interop forms, but I don't understand your remark about "those are not separate methods" and then saying "for example" where no named parameters occur in the example, or am I missing something? |
ClojureDart could support: (m/EdgeInsets.symmetric :.horizontal 10 :.vertical 5) or similar for named parameters, has this been considered? |
I misunderstood the issue. When you lint the above as CLJS it does work:
So we just have to convince clj-kondo to do the same as ClojureScript when using ClojureDart |
Yeah it's very similar to the js/console.log kind of cljs syntax. Gotta add a possible refer to the mix though (the false positive you mention) |
To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.
Is your feature request related to a problem? Please describe.
In ClojureDart you can chain property/method calls. The following is valid:
Describe the solution you'd like
Teach clj-kondo to recognize this syntax and warn only about the first bit (eg if a class name is used but never referred)
Describe alternatives you've considered
Currently we either ignore the unresolved symbol warnings where the chaining is used, or unpack the chaining like below
Additional context
I'd love to help implementing this, but I have no idea where to start
The text was updated successfully, but these errors were encountered: