MCPcopy Create free account
hub / github.com/csskit/csskit / expand_longhands_recursive

Function expand_longhands_recursive

crates/csskit_spec_generator/src/codegen.rs:22–36  ·  view source on GitHub ↗

Recursively expand longhands to get all transitive longhands

(
	property: &str,
	direct_longhands: &HashMap<String, HashSet<String>>,
	visited: &mut HashSet<String>,
	result: &mut Vec<String>,
)

Source from the content-addressed store, hash-verified

20
21/// Recursively expand longhands to get all transitive longhands
22fn expand_longhands_recursive(
23 property: &str,
24 direct_longhands: &HashMap<String, HashSet<String>>,
25 visited: &mut HashSet<String>,
26 result: &mut Vec<String>,
27) {
28 if let Some(longhands) = direct_longhands.get(property) {
29 for longhand in longhands {
30 if visited.insert(longhand.clone()) {
31 result.push(longhand.clone());
32 expand_longhands_recursive(longhand, direct_longhands, visited, result);
33 }
34 }
35 }
36}
37
38/// Compute expanded (transitive) longhands for all properties
39fn compute_all_expanded_longhands(shorthands: &HashMap<String, HashSet<String>>) -> HashMap<String, Vec<String>> {

Callers 1

Calls 3

cloneMethod · 0.80
getMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected