From 402578136f89e6d2ecf54ef295b9c0f0938a082f Mon Sep 17 00:00:00 2001 From: Connor Skees Date: Sun, 9 Jul 2023 21:39:43 +0000 Subject: [PATCH] rename children => body --- crates/compiler/src/ast/stmt.rs | 10 ++++------ crates/compiler/src/evaluate/visitor.rs | 12 ++++++------ crates/compiler/src/parse/stylesheet.rs | 12 ++++++------ 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/crates/compiler/src/ast/stmt.rs b/crates/compiler/src/ast/stmt.rs index fe89554..64a2713 100644 --- a/crates/compiler/src/ast/stmt.rs +++ b/crates/compiler/src/ast/stmt.rs @@ -123,7 +123,7 @@ pub struct AstVariableDecl { pub struct AstFunctionDecl { pub name: Spanned, pub arguments: ArgumentDeclaration, - pub children: Vec, + pub body: Vec, } #[derive(Debug, Clone)] @@ -191,7 +191,7 @@ pub struct AstInclude { pub struct AstUnknownAtRule { pub name: Interpolation, pub value: Option, - pub children: Option>, + pub body: Option>, pub span: Span, } @@ -204,8 +204,7 @@ pub struct AstExtendRule { #[derive(Debug, Clone)] pub struct AstAtRootRule { - // todo: rename to body - pub children: Vec, + pub body: Vec, pub query: Option>, #[allow(unused)] pub span: Span, @@ -522,8 +521,7 @@ pub enum AstSupportsCondition { #[derive(Debug, Clone)] pub struct AstSupportsRule { pub condition: AstSupportsCondition, - // todo: rename body - pub children: Vec, + pub body: Vec, pub span: Span, } diff --git a/crates/compiler/src/evaluate/visitor.rs b/crates/compiler/src/evaluate/visitor.rs index c9163ee..6cbe702 100644 --- a/crates/compiler/src/evaluate/visitor.rs +++ b/crates/compiler/src/evaluate/visitor.rs @@ -492,7 +492,7 @@ impl<'a> Visitor<'a> { false, ); - let children = supports_rule.children; + let children = supports_rule.body; self.with_parent( css_supports_rule, @@ -1157,7 +1157,7 @@ impl<'a> Visitor<'a> { // have created. if Some(root) == self.parent { self.with_scope::, _>(false, true, |visitor| { - for stmt in at_root_rule.children { + for stmt in at_root_rule.body { let result = visitor.visit_stmt(stmt)?; debug_assert!(result.is_none()); } @@ -1199,7 +1199,7 @@ impl<'a> Visitor<'a> { inner_copy.map(|p| self.css_tree.add_stmt(p, None)) }; - let body = mem::take(&mut at_root_rule.children); + let body = mem::take(&mut at_root_rule.body); self.with_scope_for_at_root::, _>(inner_copy, &query, |visitor| { for stmt in body { @@ -1497,7 +1497,7 @@ impl<'a> Visitor<'a> { .map(|v| self.interpolation_to_value(v, true, true)) .transpose()?; - if unknown_at_rule.children.is_none() { + if unknown_at_rule.body.is_none() { let stmt = CssStmt::UnknownAtRule( UnknownAtRule { name, @@ -1522,7 +1522,7 @@ impl<'a> Visitor<'a> { self.flags.set(ContextFlags::IN_UNKNOWN_AT_RULE, true); } - let children = unknown_at_rule.children.unwrap(); + let children = unknown_at_rule.body.unwrap(); let stmt = CssStmt::UnknownAtRule( UnknownAtRule { @@ -2395,7 +2395,7 @@ impl<'a> Visitor<'a> { } SassFunction::UserDefined(UserDefinedFunction { function, env, .. }) => self .run_user_defined_callable(arguments, function, &env, span, |function, visitor| { - for stmt in function.children.clone() { + for stmt in function.body.clone() { let result = visitor.visit_stmt(stmt)?; if let Some(val) = result { diff --git a/crates/compiler/src/parse/stylesheet.rs b/crates/compiler/src/parse/stylesheet.rs index d84d11a..39cd7a4 100644 --- a/crates/compiler/src/parse/stylesheet.rs +++ b/crates/compiler/src/parse/stylesheet.rs @@ -351,21 +351,21 @@ pub(crate) trait StylesheetParser<'a>: BaseParser<'a> + Sized { node: query, span: query_span, }), - children, + body: children, span: self.toks_mut().span_from(start), } } else if self.looking_at_children()? { let children = self.with_children(Self::parse_statement)?.node; AstAtRootRule { query: None, - children, + body: children, span: self.toks_mut().span_from(start), } } else { let child = self.parse_style_rule(None, None)?; AstAtRootRule { query: None, - children: vec![child], + body: vec![child], span: self.toks_mut().span_from(start), } })) @@ -586,7 +586,7 @@ pub(crate) trait StylesheetParser<'a>: BaseParser<'a> + Sized { span: name_span, }, arguments, - children, + body: children, })) } @@ -1154,7 +1154,7 @@ pub(crate) trait StylesheetParser<'a>: BaseParser<'a> + Sized { Ok(AstStmt::UnknownAtRule(AstUnknownAtRule { name, value, - children, + body: children, span: self.toks_mut().span_from(start), })) } @@ -1388,7 +1388,7 @@ pub(crate) trait StylesheetParser<'a>: BaseParser<'a> + Sized { Ok(AstStmt::Supports(AstSupportsRule { condition, - children: children.node, + body: children.node, span: children.span, })) }