rename children => body
This commit is contained in:
parent
61f3d17f94
commit
402578136f
@ -123,7 +123,7 @@ pub struct AstVariableDecl {
|
|||||||
pub struct AstFunctionDecl {
|
pub struct AstFunctionDecl {
|
||||||
pub name: Spanned<Identifier>,
|
pub name: Spanned<Identifier>,
|
||||||
pub arguments: ArgumentDeclaration,
|
pub arguments: ArgumentDeclaration,
|
||||||
pub children: Vec<AstStmt>,
|
pub body: Vec<AstStmt>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
@ -191,7 +191,7 @@ pub struct AstInclude {
|
|||||||
pub struct AstUnknownAtRule {
|
pub struct AstUnknownAtRule {
|
||||||
pub name: Interpolation,
|
pub name: Interpolation,
|
||||||
pub value: Option<Interpolation>,
|
pub value: Option<Interpolation>,
|
||||||
pub children: Option<Vec<AstStmt>>,
|
pub body: Option<Vec<AstStmt>>,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,8 +204,7 @@ pub struct AstExtendRule {
|
|||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct AstAtRootRule {
|
pub struct AstAtRootRule {
|
||||||
// todo: rename to body
|
pub body: Vec<AstStmt>,
|
||||||
pub children: Vec<AstStmt>,
|
|
||||||
pub query: Option<Spanned<Interpolation>>,
|
pub query: Option<Spanned<Interpolation>>,
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
@ -522,8 +521,7 @@ pub enum AstSupportsCondition {
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct AstSupportsRule {
|
pub struct AstSupportsRule {
|
||||||
pub condition: AstSupportsCondition,
|
pub condition: AstSupportsCondition,
|
||||||
// todo: rename body
|
pub body: Vec<AstStmt>,
|
||||||
pub children: Vec<AstStmt>,
|
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,7 +492,7 @@ impl<'a> Visitor<'a> {
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
let children = supports_rule.children;
|
let children = supports_rule.body;
|
||||||
|
|
||||||
self.with_parent(
|
self.with_parent(
|
||||||
css_supports_rule,
|
css_supports_rule,
|
||||||
@ -1157,7 +1157,7 @@ impl<'a> Visitor<'a> {
|
|||||||
// have created.
|
// have created.
|
||||||
if Some(root) == self.parent {
|
if Some(root) == self.parent {
|
||||||
self.with_scope::<SassResult<()>, _>(false, true, |visitor| {
|
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)?;
|
let result = visitor.visit_stmt(stmt)?;
|
||||||
debug_assert!(result.is_none());
|
debug_assert!(result.is_none());
|
||||||
}
|
}
|
||||||
@ -1199,7 +1199,7 @@ impl<'a> Visitor<'a> {
|
|||||||
inner_copy.map(|p| self.css_tree.add_stmt(p, None))
|
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| {
|
self.with_scope_for_at_root::<SassResult<()>, _>(inner_copy, &query, |visitor| {
|
||||||
for stmt in body {
|
for stmt in body {
|
||||||
@ -1497,7 +1497,7 @@ impl<'a> Visitor<'a> {
|
|||||||
.map(|v| self.interpolation_to_value(v, true, true))
|
.map(|v| self.interpolation_to_value(v, true, true))
|
||||||
.transpose()?;
|
.transpose()?;
|
||||||
|
|
||||||
if unknown_at_rule.children.is_none() {
|
if unknown_at_rule.body.is_none() {
|
||||||
let stmt = CssStmt::UnknownAtRule(
|
let stmt = CssStmt::UnknownAtRule(
|
||||||
UnknownAtRule {
|
UnknownAtRule {
|
||||||
name,
|
name,
|
||||||
@ -1522,7 +1522,7 @@ impl<'a> Visitor<'a> {
|
|||||||
self.flags.set(ContextFlags::IN_UNKNOWN_AT_RULE, true);
|
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(
|
let stmt = CssStmt::UnknownAtRule(
|
||||||
UnknownAtRule {
|
UnknownAtRule {
|
||||||
@ -2395,7 +2395,7 @@ impl<'a> Visitor<'a> {
|
|||||||
}
|
}
|
||||||
SassFunction::UserDefined(UserDefinedFunction { function, env, .. }) => self
|
SassFunction::UserDefined(UserDefinedFunction { function, env, .. }) => self
|
||||||
.run_user_defined_callable(arguments, function, &env, span, |function, visitor| {
|
.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)?;
|
let result = visitor.visit_stmt(stmt)?;
|
||||||
|
|
||||||
if let Some(val) = result {
|
if let Some(val) = result {
|
||||||
|
@ -351,21 +351,21 @@ pub(crate) trait StylesheetParser<'a>: BaseParser<'a> + Sized {
|
|||||||
node: query,
|
node: query,
|
||||||
span: query_span,
|
span: query_span,
|
||||||
}),
|
}),
|
||||||
children,
|
body: children,
|
||||||
span: self.toks_mut().span_from(start),
|
span: self.toks_mut().span_from(start),
|
||||||
}
|
}
|
||||||
} else if self.looking_at_children()? {
|
} else if self.looking_at_children()? {
|
||||||
let children = self.with_children(Self::parse_statement)?.node;
|
let children = self.with_children(Self::parse_statement)?.node;
|
||||||
AstAtRootRule {
|
AstAtRootRule {
|
||||||
query: None,
|
query: None,
|
||||||
children,
|
body: children,
|
||||||
span: self.toks_mut().span_from(start),
|
span: self.toks_mut().span_from(start),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let child = self.parse_style_rule(None, None)?;
|
let child = self.parse_style_rule(None, None)?;
|
||||||
AstAtRootRule {
|
AstAtRootRule {
|
||||||
query: None,
|
query: None,
|
||||||
children: vec![child],
|
body: vec![child],
|
||||||
span: self.toks_mut().span_from(start),
|
span: self.toks_mut().span_from(start),
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
@ -586,7 +586,7 @@ pub(crate) trait StylesheetParser<'a>: BaseParser<'a> + Sized {
|
|||||||
span: name_span,
|
span: name_span,
|
||||||
},
|
},
|
||||||
arguments,
|
arguments,
|
||||||
children,
|
body: children,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1154,7 +1154,7 @@ pub(crate) trait StylesheetParser<'a>: BaseParser<'a> + Sized {
|
|||||||
Ok(AstStmt::UnknownAtRule(AstUnknownAtRule {
|
Ok(AstStmt::UnknownAtRule(AstUnknownAtRule {
|
||||||
name,
|
name,
|
||||||
value,
|
value,
|
||||||
children,
|
body: children,
|
||||||
span: self.toks_mut().span_from(start),
|
span: self.toks_mut().span_from(start),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
@ -1388,7 +1388,7 @@ pub(crate) trait StylesheetParser<'a>: BaseParser<'a> + Sized {
|
|||||||
|
|
||||||
Ok(AstStmt::Supports(AstSupportsRule {
|
Ok(AstStmt::Supports(AstSupportsRule {
|
||||||
condition,
|
condition,
|
||||||
children: children.node,
|
body: children.node,
|
||||||
span: children.span,
|
span: children.span,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user