rename children => body

This commit is contained in:
Connor Skees 2023-07-09 21:39:43 +00:00
parent 61f3d17f94
commit 402578136f
3 changed files with 16 additions and 18 deletions

View File

@ -123,7 +123,7 @@ pub struct AstVariableDecl {
pub struct AstFunctionDecl {
pub name: Spanned<Identifier>,
pub arguments: ArgumentDeclaration,
pub children: Vec<AstStmt>,
pub body: Vec<AstStmt>,
}
#[derive(Debug, Clone)]
@ -191,7 +191,7 @@ pub struct AstInclude {
pub struct AstUnknownAtRule {
pub name: Interpolation,
pub value: Option<Interpolation>,
pub children: Option<Vec<AstStmt>>,
pub body: Option<Vec<AstStmt>>,
pub span: Span,
}
@ -204,8 +204,7 @@ pub struct AstExtendRule {
#[derive(Debug, Clone)]
pub struct AstAtRootRule {
// todo: rename to body
pub children: Vec<AstStmt>,
pub body: Vec<AstStmt>,
pub query: Option<Spanned<Interpolation>>,
#[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<AstStmt>,
pub body: Vec<AstStmt>,
pub span: Span,
}

View File

@ -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::<SassResult<()>, _>(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::<SassResult<()>, _>(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 {

View File

@ -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,
}))
}