Class: Seafoam::Passes::FallbackPass
- Inherits:
-
Seafoam::Pass
- Object
- Seafoam::Pass
- Seafoam::Passes::FallbackPass
- Defined in:
- lib/seafoam/passes/fallback.rb
Overview
The fallback pass always applies, and adds some basic properties. Works for example with Truffle AST and call graphs, but also means anyone can emit a graph with ‘label’ properties and we can do something useful with it.
Constant Summary
Constants inherited from Seafoam::Pass
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Seafoam::Pass
#applies?, inherited, #initialize
Constructor Details
This class inherits a constructor from Seafoam::Pass
Class Method Details
.applies?(_graph) ⇒ Boolean
8 9 10 |
# File 'lib/seafoam/passes/fallback.rb', line 8 def self.applies?(_graph) true end |
Instance Method Details
#apply(graph) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/seafoam/passes/fallback.rb', line 12 def apply(graph) graph.nodes.each_value do |node| if node.props[:label].nil? && node.props['label'] node.props[:label] = node.props['label'] end node.props[:kind] ||= 'other' end graph.edges.each do |edge| edge.props[:kind] ||= 'other' end end |