Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(css_parser): Renamed 'CssSimpleFunction' to 'CssFunction' #1588

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions crates/biome_css_factory/src/generated/node_factory.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 40 additions & 40 deletions crates/biome_css_factory/src/generated/syntax_factory.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/biome_css_formatter/src/css/any/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ impl FormatRule<AnyCssFunction> for FormatAnyCssFunction {
type Context = CssFormatContext;
fn fmt(&self, node: &AnyCssFunction, f: &mut CssFormatter) -> FormatResult<()> {
match node {
AnyCssFunction::CssSimpleFunction(node) => node.format().fmt(f),
AnyCssFunction::CssFunction(node) => node.format().fmt(f),
AnyCssFunction::CssUrlFunction(node) => node.format().fmt(f),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ impl FormatRule<AnyCssSupportsInParens> for FormatAnyCssSupportsInParens {
AnyCssSupportsInParens::CssSupportsConditionInParens(node) => node.format().fmt(f),
AnyCssSupportsInParens::CssSupportsFeatureDeclaration(node) => node.format().fmt(f),
AnyCssSupportsInParens::CssSupportsFeatureSelector(node) => node.format().fmt(f),
AnyCssSupportsInParens::CssSimpleFunction(node) => node.format().fmt(f),
AnyCssSupportsInParens::CssFunction(node) => node.format().fmt(f),
AnyCssSupportsInParens::AnyCssValue(node) => node.format().fmt(f),
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_css_formatter/src/css/any/url_modifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ impl FormatRule<AnyCssUrlModifier> for FormatAnyCssUrlModifier {
fn fmt(&self, node: &AnyCssUrlModifier, f: &mut CssFormatter) -> FormatResult<()> {
match node {
AnyCssUrlModifier::CssIdentifier(node) => node.format().fmt(f),
AnyCssUrlModifier::CssSimpleFunction(node) => node.format().fmt(f),
AnyCssUrlModifier::CssFunction(node) => node.format().fmt(f),
AnyCssUrlModifier::CssBogusUrlModifier(node) => node.format().fmt(f),
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use crate::prelude::*;
use biome_css_syntax::{CssSimpleFunction, CssSimpleFunctionFields};
use biome_css_syntax::{CssFunction, CssFunctionFields};
use biome_formatter::{format_args, write};

#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssSimpleFunction;
impl FormatNodeRule<CssSimpleFunction> for FormatCssSimpleFunction {
fn fmt_fields(&self, node: &CssSimpleFunction, f: &mut CssFormatter) -> FormatResult<()> {
let CssSimpleFunctionFields {
pub(crate) struct FormatCssFunction;
impl FormatNodeRule<CssFunction> for FormatCssFunction {
fn fmt_fields(&self, node: &CssFunction, f: &mut CssFormatter) -> FormatResult<()> {
let CssFunctionFields {
name,
l_paren_token,
items,
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_css_formatter/src/css/auxiliary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub(crate) mod declaration_list_block;
pub(crate) mod declaration_or_at_rule_block;
pub(crate) mod declaration_with_semicolon;
pub(crate) mod document_custom_matcher;
pub(crate) mod function;
pub(crate) mod generic_delimiter;
pub(crate) mod import_anonymous_layer;
pub(crate) mod import_named_layer;
Expand Down Expand Up @@ -61,7 +62,6 @@ pub(crate) mod scope_edge;
pub(crate) mod scope_range_end;
pub(crate) mod scope_range_interval;
pub(crate) mod scope_range_start;
pub(crate) mod simple_function;
pub(crate) mod supports_and_condition;
pub(crate) mod supports_condition_in_parens;
pub(crate) mod supports_feature_declaration;
Expand Down
28 changes: 12 additions & 16 deletions crates/biome_css_formatter/src/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4353,43 +4353,39 @@ impl IntoFormat<CssFormatContext> for biome_css_syntax::CssSupportsFeatureSelect
FormatOwnedWithRule :: new (self , crate :: css :: selectors :: supports_feature_selector :: FormatCssSupportsFeatureSelector :: default ())
}
}
impl FormatRule<biome_css_syntax::CssSimpleFunction>
for crate::css::auxiliary::simple_function::FormatCssSimpleFunction
impl FormatRule<biome_css_syntax::CssFunction>
for crate::css::auxiliary::function::FormatCssFunction
{
type Context = CssFormatContext;
#[inline(always)]
fn fmt(
&self,
node: &biome_css_syntax::CssSimpleFunction,
f: &mut CssFormatter,
) -> FormatResult<()> {
FormatNodeRule::<biome_css_syntax::CssSimpleFunction>::fmt(self, node, f)
fn fmt(&self, node: &biome_css_syntax::CssFunction, f: &mut CssFormatter) -> FormatResult<()> {
FormatNodeRule::<biome_css_syntax::CssFunction>::fmt(self, node, f)
}
}
impl AsFormat<CssFormatContext> for biome_css_syntax::CssSimpleFunction {
impl AsFormat<CssFormatContext> for biome_css_syntax::CssFunction {
type Format<'a> = FormatRefWithRule<
'a,
biome_css_syntax::CssSimpleFunction,
crate::css::auxiliary::simple_function::FormatCssSimpleFunction,
biome_css_syntax::CssFunction,
crate::css::auxiliary::function::FormatCssFunction,
>;
fn format(&self) -> Self::Format<'_> {
#![allow(clippy::default_constructed_unit_structs)]
FormatRefWithRule::new(
self,
crate::css::auxiliary::simple_function::FormatCssSimpleFunction::default(),
crate::css::auxiliary::function::FormatCssFunction::default(),
)
}
}
impl IntoFormat<CssFormatContext> for biome_css_syntax::CssSimpleFunction {
impl IntoFormat<CssFormatContext> for biome_css_syntax::CssFunction {
type Format = FormatOwnedWithRule<
biome_css_syntax::CssSimpleFunction,
crate::css::auxiliary::simple_function::FormatCssSimpleFunction,
biome_css_syntax::CssFunction,
crate::css::auxiliary::function::FormatCssFunction,
>;
fn into_format(self) -> Self::Format {
#![allow(clippy::default_constructed_unit_structs)]
FormatOwnedWithRule::new(
self,
crate::css::auxiliary::simple_function::FormatCssSimpleFunction::default(),
crate::css::auxiliary::function::FormatCssFunction::default(),
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_css_parser/src/syntax/at_rule/keyframes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use crate::syntax::at_rule::parse_error::{
expected_keyframes_item, expected_keyframes_item_selector,
};
use crate::syntax::blocks::{parse_block_body, parse_declaration_list_block};
use crate::syntax::css_dimension::{is_at_percentage_dimension, parse_percentage_dimension};
use crate::syntax::parse_error::{expected_block, expected_non_css_wide_keyword_identifier};
use crate::syntax::value::dimension::{is_at_percentage_dimension, parse_percentage_dimension};
use crate::syntax::{
is_at_declaration, is_at_identifier, parse_custom_identifier, parse_string, BODY_RECOVERY_SET,
};
Expand Down
10 changes: 4 additions & 6 deletions crates/biome_css_parser/src/syntax/at_rule/supports.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use crate::parser::CssParser;
use crate::syntax::blocks::parse_or_recover_rule_list_block;
use crate::syntax::selector::parse_selector;
use crate::syntax::{
is_at_any_function, is_nth_at_identifier, parse_any_value, parse_declaration,
parse_simple_function,
};
use crate::syntax::value::function::{is_at_function, parse_function};
use crate::syntax::{is_nth_at_identifier, parse_any_value, parse_declaration};
use biome_css_syntax::CssSyntaxKind::*;
use biome_css_syntax::T;
use biome_parser::parsed_syntax::ParsedSyntax::Present;
Expand Down Expand Up @@ -111,8 +109,8 @@ fn parse_any_supports_condition_in_parens(p: &mut CssParser) -> ParsedSyntax {
parse_supports_feature_selector(p)
} else if is_at_supports_feature_declaration(p) {
parse_supports_feature_declaration(p)
} else if is_at_any_function(p) {
parse_simple_function(p)
} else if is_at_function(p) {
parse_function(p)
} else if is_at_supports_condition_in_parens(p) {
parse_supports_condition_in_parens(p) // TODO handle error
} else {
Expand Down
Loading
Loading