Skip to content

Commit

Permalink
fix(attr_parse): Add missing impls for TypeParam, GenericParam
Browse files Browse the repository at this point in the history
  • Loading branch information
Alorel committed Sep 4, 2023
1 parent 973d070 commit d48c770
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion examples/all_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mod test {
define!(AllTypes =>
bool, String, char, f32, f64, u8, i8, u16, i16, u32, i32, u64, i64, usize, isize,
Expr, AngleBracketedGenericArguments, ConstParam, Abi, BareFnArg, Ident, Path, Meta, MetaList, MetaNameValue, Visibility,
Lifetime, LifetimeParam, BoundLifetimes, TypeParamBound, TraitBound,
Lifetime, LifetimeParam, BoundLifetimes, TypeParamBound, TraitBound, TypeParam, GenericParam,
Lit, LitBool, LitByteStr, LitByte, LitStr, LitChar, LitInt, LitFloat, Literal,
Type, TypeArray, TypeBareFn, TypeImplTrait, TypeInfer, TypeMacro, TypeNever, TypeParen, TypePath, TypePtr, TypeReference, TypeSlice, TypeTraitObject, TypeTuple,
ExprArray, ExprAssign, ExprAsync, ExprAwait, ExprBinary, ExprBlock, ExprBreak, ExprCall, ExprCast, ExprClosure, ExprConst, ExprContinue, ExprField, ExprForLoop, ExprIf, ExprIndex, ExprInfer, ExprLet, ExprLit, ExprLoop, ExprMacro, ExprMatch, ExprMethodCall, ExprParen, ExprPath, ExprRange, ExprReference, ExprRepeat, ExprReturn, ExprStruct, ExprTry, ExprTryBlock, ExprTuple, ExprUnary, ExprUnsafe, ExprWhile, ExprYield
Expand Down Expand Up @@ -73,6 +73,8 @@ mod test {
BoundLifetimes(for<'x>),
TraitBound(?Sized),
TypeParamBound(?Sized),
TypeParam(T: Clone),
GenericParam(T: Clone),
Lit(true),
LitBool = false,
LitByteStr(b"foo"),
Expand Down Expand Up @@ -170,6 +172,8 @@ mod test {
assert_eq!(allty.BoundLifetimes, parse_quote! { for<'x> });
assert_eq!(allty.TraitBound, parse_quote! { ?Sized });
assert_eq!(allty.TypeParamBound, parse_quote! { ?Sized });
assert_eq!(allty.TypeParam, parse_quote! { T: Clone });
assert_eq!(allty.GenericParam, parse_quote! { T: Clone });
assert_eq!(allty.Lit, parse_quote! { true });
assert_eq!(allty.LitBool, parse_quote! { false });
assert_eq!(allty.LitByteStr, parse_quote! { b"foo" });
Expand Down
4 changes: 2 additions & 2 deletions modules/macroific-attr-parse/src/parse_option_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ macro_rules! from_expr {
};
}

from_expr!(tokenise [Lifetime, LifetimeParam, BoundLifetimes, TypeParamBound, TraitBound]);
from_expr!(tokenise [Lifetime, LifetimeParam, BoundLifetimes, TypeParamBound, TraitBound, TypeParam, GenericParam]);
from_expr!(tokenise [Ident, Type, TypeArray, TypeBareFn, TypeGroup, TypeImplTrait, TypeInfer, TypeMacro, TypeNever, TypeParen, TypePath, TypePtr, TypeReference, TypeSlice, TypeTraitObject, TypeTuple, AngleBracketedGenericArguments, ConstParam, Abi, BareFnArg, Meta, MetaList, MetaNameValue, Visibility]);
from_expr!(lit [Str => LitStr], [ByteStr => LitByteStr], [Byte => LitByte], [Char => LitChar], [Int => LitInt], [Float => LitFloat], [Verbatim => Literal]);
from_expr!(direct [Array => ExprArray], [Assign => ExprAssign], [Async => ExprAsync], [Await => ExprAwait], [Binary => ExprBinary], [Block => ExprBlock], [Break => ExprBreak], [Call => ExprCall], [Cast => ExprCast], [Closure => ExprClosure], [Const => ExprConst], [Continue => ExprContinue], [Field => ExprField], [ForLoop => ExprForLoop], [Group => ExprGroup], [If => ExprIf], [Infer => ExprInfer], [Index => ExprIndex], [Let => ExprLet], [Lit => ExprLit], [Loop => ExprLoop], [Macro => ExprMacro], [Match => ExprMatch], [MethodCall => ExprMethodCall], [Paren => ExprParen], [Path => ExprPath], [Range => ExprRange], [Reference => ExprReference], [Repeat => ExprRepeat], [Return => ExprReturn], [Struct => ExprStruct], [Try => ExprTry], [TryBlock => ExprTryBlock], [Tuple => ExprTuple], [Unary => ExprUnary], [Unsafe => ExprUnsafe], [While => ExprWhile], [Yield => ExprYield]);
Expand All @@ -240,7 +240,7 @@ parse_impl!(lit_num [LitFloat => f32, f64]);
parse_impl!(lit_num [LitInt => u8, i8, u16, i16, u32, i32, u64, i64, usize, isize]);

parse_impl!(parse [Expr, AngleBracketedGenericArguments, ConstParam, Abi, BareFnArg, Ident, Path, Meta, MetaList, MetaNameValue, Visibility]);
parse_impl!(parse [Lifetime, LifetimeParam, BoundLifetimes, TypeParamBound, TraitBound]);
parse_impl!(parse [Lifetime, LifetimeParam, BoundLifetimes, TypeParamBound, TraitBound, TypeParam, GenericParam]);
parse_impl!(parse [Lit, LitBool, LitByteStr, LitByte, LitStr, LitChar, LitInt, LitFloat, Literal]);
parse_impl!(parse [Type, TypeArray, TypeBareFn, TypeGroup, TypeImplTrait, TypeInfer, TypeMacro, TypeNever, TypeParen, TypePath, TypePtr, TypeReference, TypeSlice, TypeTraitObject, TypeTuple]);

Expand Down

0 comments on commit d48c770

Please sign in to comment.