Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
feat: 🎸 more strict constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
IWANABETHATGUY committed Sep 12, 2022
1 parent f45c26f commit 79d2af3
Show file tree
Hide file tree
Showing 4 changed files with 479 additions and 208 deletions.
306 changes: 153 additions & 153 deletions crates/rome_js_formatter/src/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2856,6 +2856,134 @@ impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::JsxTagExpression {
)
}
}
impl FormatRule<rome_js_syntax::JsxElement> for crate::jsx::tag::element::FormatJsxElement {
type Context = JsFormatContext;
#[inline(always)]
fn fmt(&self, node: &rome_js_syntax::JsxElement, f: &mut JsFormatter) -> FormatResult<()> {
FormatNodeRule::<rome_js_syntax::JsxElement>::fmt(self, node, f)
}
}
impl<'a> AsFormat<'a> for rome_js_syntax::JsxElement {
type Format = FormatRefWithRule<
'a,
rome_js_syntax::JsxElement,
crate::jsx::tag::element::FormatJsxElement,
>;
fn format(&'a self) -> Self::Format {
FormatRefWithRule::new(self, crate::jsx::tag::element::FormatJsxElement::default())
}
}
impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::JsxElement {
type Format =
FormatOwnedWithRule<rome_js_syntax::JsxElement, crate::jsx::tag::element::FormatJsxElement>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(self, crate::jsx::tag::element::FormatJsxElement::default())
}
}
impl FormatRule<rome_js_syntax::JsxSelfClosingElement>
for crate::jsx::tag::self_closing_element::FormatJsxSelfClosingElement
{
type Context = JsFormatContext;
#[inline(always)]
fn fmt(
&self,
node: &rome_js_syntax::JsxSelfClosingElement,
f: &mut JsFormatter,
) -> FormatResult<()> {
FormatNodeRule::<rome_js_syntax::JsxSelfClosingElement>::fmt(self, node, f)
}
}
impl<'a> AsFormat<'a> for rome_js_syntax::JsxSelfClosingElement {
type Format = FormatRefWithRule<
'a,
rome_js_syntax::JsxSelfClosingElement,
crate::jsx::tag::self_closing_element::FormatJsxSelfClosingElement,
>;
fn format(&'a self) -> Self::Format {
FormatRefWithRule::new(
self,
crate::jsx::tag::self_closing_element::FormatJsxSelfClosingElement::default(),
)
}
}
impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::JsxSelfClosingElement {
type Format = FormatOwnedWithRule<
rome_js_syntax::JsxSelfClosingElement,
crate::jsx::tag::self_closing_element::FormatJsxSelfClosingElement,
>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(
self,
crate::jsx::tag::self_closing_element::FormatJsxSelfClosingElement::default(),
)
}
}
impl FormatRule<rome_js_syntax::JsxFragment> for crate::jsx::tag::fragment::FormatJsxFragment {
type Context = JsFormatContext;
#[inline(always)]
fn fmt(&self, node: &rome_js_syntax::JsxFragment, f: &mut JsFormatter) -> FormatResult<()> {
FormatNodeRule::<rome_js_syntax::JsxFragment>::fmt(self, node, f)
}
}
impl<'a> AsFormat<'a> for rome_js_syntax::JsxFragment {
type Format = FormatRefWithRule<
'a,
rome_js_syntax::JsxFragment,
crate::jsx::tag::fragment::FormatJsxFragment,
>;
fn format(&'a self) -> Self::Format {
FormatRefWithRule::new(
self,
crate::jsx::tag::fragment::FormatJsxFragment::default(),
)
}
}
impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::JsxFragment {
type Format = FormatOwnedWithRule<
rome_js_syntax::JsxFragment,
crate::jsx::tag::fragment::FormatJsxFragment,
>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(
self,
crate::jsx::tag::fragment::FormatJsxFragment::default(),
)
}
}
impl FormatRule<rome_js_syntax::JsPrivateName>
for crate::js::auxiliary::private_name::FormatJsPrivateName
{
type Context = JsFormatContext;
#[inline(always)]
fn fmt(&self, node: &rome_js_syntax::JsPrivateName, f: &mut JsFormatter) -> FormatResult<()> {
FormatNodeRule::<rome_js_syntax::JsPrivateName>::fmt(self, node, f)
}
}
impl<'a> AsFormat<'a> for rome_js_syntax::JsPrivateName {
type Format = FormatRefWithRule<
'a,
rome_js_syntax::JsPrivateName,
crate::js::auxiliary::private_name::FormatJsPrivateName,
>;
fn format(&'a self) -> Self::Format {
FormatRefWithRule::new(
self,
crate::js::auxiliary::private_name::FormatJsPrivateName::default(),
)
}
}
impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::JsPrivateName {
type Format = FormatOwnedWithRule<
rome_js_syntax::JsPrivateName,
crate::js::auxiliary::private_name::FormatJsPrivateName,
>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(
self,
crate::js::auxiliary::private_name::FormatJsPrivateName::default(),
)
}
}
impl FormatRule<rome_js_syntax::TsTypeArguments>
for crate::ts::expressions::type_arguments::FormatTsTypeArguments
{
Expand Down Expand Up @@ -3280,40 +3408,6 @@ impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::JsReferenceIdentifie
)
}
}
impl FormatRule<rome_js_syntax::JsPrivateName>
for crate::js::auxiliary::private_name::FormatJsPrivateName
{
type Context = JsFormatContext;
#[inline(always)]
fn fmt(&self, node: &rome_js_syntax::JsPrivateName, f: &mut JsFormatter) -> FormatResult<()> {
FormatNodeRule::<rome_js_syntax::JsPrivateName>::fmt(self, node, f)
}
}
impl<'a> AsFormat<'a> for rome_js_syntax::JsPrivateName {
type Format = FormatRefWithRule<
'a,
rome_js_syntax::JsPrivateName,
crate::js::auxiliary::private_name::FormatJsPrivateName,
>;
fn format(&'a self) -> Self::Format {
FormatRefWithRule::new(
self,
crate::js::auxiliary::private_name::FormatJsPrivateName::default(),
)
}
}
impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::JsPrivateName {
type Format = FormatOwnedWithRule<
rome_js_syntax::JsPrivateName,
crate::js::auxiliary::private_name::FormatJsPrivateName,
>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(
self,
crate::js::auxiliary::private_name::FormatJsPrivateName::default(),
)
}
}
impl FormatRule<rome_js_syntax::JsLiteralMemberName>
for crate::js::objects::literal_member_name::FormatJsLiteralMemberName
{
Expand Down Expand Up @@ -8796,100 +8890,6 @@ impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::TsQualifiedName {
)
}
}
impl FormatRule<rome_js_syntax::JsxElement> for crate::jsx::tag::element::FormatJsxElement {
type Context = JsFormatContext;
#[inline(always)]
fn fmt(&self, node: &rome_js_syntax::JsxElement, f: &mut JsFormatter) -> FormatResult<()> {
FormatNodeRule::<rome_js_syntax::JsxElement>::fmt(self, node, f)
}
}
impl<'a> AsFormat<'a> for rome_js_syntax::JsxElement {
type Format = FormatRefWithRule<
'a,
rome_js_syntax::JsxElement,
crate::jsx::tag::element::FormatJsxElement,
>;
fn format(&'a self) -> Self::Format {
FormatRefWithRule::new(self, crate::jsx::tag::element::FormatJsxElement::default())
}
}
impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::JsxElement {
type Format =
FormatOwnedWithRule<rome_js_syntax::JsxElement, crate::jsx::tag::element::FormatJsxElement>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(self, crate::jsx::tag::element::FormatJsxElement::default())
}
}
impl FormatRule<rome_js_syntax::JsxSelfClosingElement>
for crate::jsx::tag::self_closing_element::FormatJsxSelfClosingElement
{
type Context = JsFormatContext;
#[inline(always)]
fn fmt(
&self,
node: &rome_js_syntax::JsxSelfClosingElement,
f: &mut JsFormatter,
) -> FormatResult<()> {
FormatNodeRule::<rome_js_syntax::JsxSelfClosingElement>::fmt(self, node, f)
}
}
impl<'a> AsFormat<'a> for rome_js_syntax::JsxSelfClosingElement {
type Format = FormatRefWithRule<
'a,
rome_js_syntax::JsxSelfClosingElement,
crate::jsx::tag::self_closing_element::FormatJsxSelfClosingElement,
>;
fn format(&'a self) -> Self::Format {
FormatRefWithRule::new(
self,
crate::jsx::tag::self_closing_element::FormatJsxSelfClosingElement::default(),
)
}
}
impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::JsxSelfClosingElement {
type Format = FormatOwnedWithRule<
rome_js_syntax::JsxSelfClosingElement,
crate::jsx::tag::self_closing_element::FormatJsxSelfClosingElement,
>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(
self,
crate::jsx::tag::self_closing_element::FormatJsxSelfClosingElement::default(),
)
}
}
impl FormatRule<rome_js_syntax::JsxFragment> for crate::jsx::tag::fragment::FormatJsxFragment {
type Context = JsFormatContext;
#[inline(always)]
fn fmt(&self, node: &rome_js_syntax::JsxFragment, f: &mut JsFormatter) -> FormatResult<()> {
FormatNodeRule::<rome_js_syntax::JsxFragment>::fmt(self, node, f)
}
}
impl<'a> AsFormat<'a> for rome_js_syntax::JsxFragment {
type Format = FormatRefWithRule<
'a,
rome_js_syntax::JsxFragment,
crate::jsx::tag::fragment::FormatJsxFragment,
>;
fn format(&'a self) -> Self::Format {
FormatRefWithRule::new(
self,
crate::jsx::tag::fragment::FormatJsxFragment::default(),
)
}
}
impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::JsxFragment {
type Format = FormatOwnedWithRule<
rome_js_syntax::JsxFragment,
crate::jsx::tag::fragment::FormatJsxFragment,
>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(
self,
crate::jsx::tag::fragment::FormatJsxFragment::default(),
)
}
}
impl FormatRule<rome_js_syntax::JsxOpeningElement>
for crate::jsx::tag::opening_element::FormatJsxOpeningElement
{
Expand Down Expand Up @@ -10839,6 +10839,31 @@ impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::JsAnyLiteralExpressi
)
}
}
impl<'a> AsFormat<'a> for rome_js_syntax::JsLeftHandSideExpression {
type Format = FormatRefWithRule<
'a,
rome_js_syntax::JsLeftHandSideExpression,
crate::js::any::left_hand_side_expression::FormatJsLeftHandSideExpression,
>;
fn format(&'a self) -> Self::Format {
FormatRefWithRule::new(
self,
crate::js::any::left_hand_side_expression::FormatJsLeftHandSideExpression::default(),
)
}
}
impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::JsLeftHandSideExpression {
type Format = FormatOwnedWithRule<
rome_js_syntax::JsLeftHandSideExpression,
crate::js::any::left_hand_side_expression::FormatJsLeftHandSideExpression,
>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(
self,
crate::js::any::left_hand_side_expression::FormatJsLeftHandSideExpression::default(),
)
}
}
impl<'a> AsFormat<'a> for rome_js_syntax::JsAnyTemplateElement {
type Format = FormatRefWithRule<
'a,
Expand Down Expand Up @@ -11983,31 +12008,6 @@ impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::TsAnyTemplateElement
)
}
}
impl<'a> AsFormat<'a> for rome_js_syntax::JsLeftHandSideExpression {
type Format = FormatRefWithRule<
'a,
rome_js_syntax::JsLeftHandSideExpression,
crate::js::any::left_hand_side_expression::FormatJsLeftHandSideExpression,
>;
fn format(&'a self) -> Self::Format {
FormatRefWithRule::new(
self,
crate::js::any::left_hand_side_expression::FormatJsLeftHandSideExpression::default(),
)
}
}
impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::JsLeftHandSideExpression {
type Format = FormatOwnedWithRule<
rome_js_syntax::JsLeftHandSideExpression,
crate::js::any::left_hand_side_expression::FormatJsLeftHandSideExpression,
>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(
self,
crate::js::any::left_hand_side_expression::FormatJsLeftHandSideExpression::default(),
)
}
}
impl<'a> AsFormat<'a> for rome_js_syntax::JsxAnyTag {
type Format =
FormatRefWithRule<'a, rome_js_syntax::JsxAnyTag, crate::jsx::any::tag::FormatJsxAnyTag>;
Expand Down
18 changes: 15 additions & 3 deletions crates/rome_js_formatter/src/js/any/left_hand_side_expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,25 @@ impl FormatRule<JsLeftHandSideExpression> for FormatJsLeftHandSideExpression {
type Context = JsFormatContext;
fn fmt(&self, node: &JsLeftHandSideExpression, f: &mut JsFormatter) -> FormatResult<()> {
match node {
JsLeftHandSideExpression::JsParenthesizedExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsStaticMemberExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsComputedMemberExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsNewExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsCallExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsxElement(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsxSelfClosingElement(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsxFragment(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsTemplate(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsArrayExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsParenthesizedExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsObjectExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsClassExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsFunctionExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsIdentifierExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsAnyLiteralExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::TsInstantiationExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsThisExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsPrivateName(node) => node.format().fmt(f),
JsLeftHandSideExpression::TsNonNullAssertionExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::TsTypeAssertionExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::TsAsExpression(node) => node.format().fmt(f),
}
}
}
Loading

0 comments on commit 79d2af3

Please sign in to comment.