-
Notifications
You must be signed in to change notification settings - Fork 653
feat(playground): display the control flow graph in the playground #2969
Conversation
7e04b70
to
22da9ff
Compare
Deploying with
|
Latest commit: |
6bd0a60
|
Status: | ✅ Deploy successful! |
Preview URL: | https://76b8fda2.tools-8rn.pages.dev |
Branch Preview URL: | https://feature-playground-cfg.tools-8rn.pages.dev |
The new tab can't been seen on mobile |
22da9ff
to
b1e9417
Compare
self.inner.find_rule(group, rule) | ||
} | ||
|
||
fn match_query(&mut self, params: MatchQueryParams<L>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this function differ from match_query
of QueryMatcher
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MatcherLayer
struct is an "adapter type" that implements the QueryMatcher
trait on top of another, generic type also implementing this trait. It's similar to Iterator
adapters like Inspect<T>
that implements the iterator trait by calling through to the underlying T: Iterator
object, then passing the items returned by next
to the provided callback (the difference is that MatcherLayer
calls the layer
callback function before calling the implementation of match_query
for the underlying matcher type)
d80c81f
to
e5a0e4b
Compare
@leops could you check why the deployment on CloudFlare fails? Hopefully it's their fault |
crates/rome_js_analyze/src/lib.rs
Outdated
@@ -54,7 +60,7 @@ where | |||
} | |||
|
|||
let mut analyzer = Analyzer::new( | |||
build_registry(&filter), | |||
MatcherLayer::new(build_registry(&filter), matcher_layer), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be an option to add this functionality instead on Analyzer
as inspect
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would work, but in the end the rome_js_analyze
library would probably still need to expose two functions since the internal Analyzer
is not part of the public API
76f5ac4
to
bffc514
Compare
bffc514
to
bfd185e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I think it's an issue with the temporary deployment (it tries to load the content page for the iframe at |
5065d24
to
3290451
Compare
The CI check is failing on false positives for the |
I don't mind merging the PR |
Summary
This PR add a new "Control Flow Graph" tab in the playground displaying the control flow graph for the currently selected function (the function that contains either the cursor or the start of the current selection) using mermaid.js
In order to extract the CFG from the analyzer I introduced a concept of "matcher layer" that can wrap an existing query matcher and intercept incoming query matches from the visitors. Calling the analyzer through the existing
analyze
entry point simply uses an empty layer function, this is all statically dispatched so it should all get inlined and come out as zero-cost in the end.