mirror of
https://github.com/github/codeql.git
synced 2026-04-27 09:45:15 +02:00
Merge branch 'main' into redsun82/codegen-annotate
This commit is contained in:
2
rust/extractor/src/generated/.generated.list
generated
2
rust/extractor/src/generated/.generated.list
generated
@@ -1,2 +1,2 @@
|
||||
mod.rs 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7
|
||||
top.rs 6cb5c672cc7e8f2f3870c7d8b36714bfb42148fd94a097458d0011e135ea899a 6cb5c672cc7e8f2f3870c7d8b36714bfb42148fd94a097458d0011e135ea899a
|
||||
top.rs 170c3892b5cbb8be28ae420a92ebab3b96b354c3b7ea2ba96edec64e639e8455 170c3892b5cbb8be28ae420a92ebab3b96b354c3b7ea2ba96edec64e639e8455
|
||||
|
||||
180
rust/extractor/src/generated/top.rs
generated
180
rust/extractor/src/generated/top.rs
generated
@@ -1202,6 +1202,7 @@ impl From<trap::Label<MatchGuard>> for trap::Label<Locatable> {
|
||||
pub struct Meta {
|
||||
pub id: trap::TrapId<Meta>,
|
||||
pub expr: Option<trap::Label<Expr>>,
|
||||
pub is_unsafe: bool,
|
||||
pub path: Option<trap::Label<Path>>,
|
||||
pub token_tree: Option<trap::Label<TokenTree>>,
|
||||
}
|
||||
@@ -1216,6 +1217,9 @@ impl trap::TrapEntry for Meta {
|
||||
if let Some(v) = self.expr {
|
||||
out.add_tuple("meta_exprs", vec![id.into(), v.into()]);
|
||||
}
|
||||
if self.is_unsafe {
|
||||
out.add_tuple("meta_is_unsafe", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.path {
|
||||
out.add_tuple("meta_paths", vec![id.into(), v.into()]);
|
||||
}
|
||||
@@ -2072,6 +2076,7 @@ impl From<trap::Label<ReturnTypeSyntax>> for trap::Label<Locatable> {
|
||||
pub struct SelfParam {
|
||||
pub id: trap::TrapId<SelfParam>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub is_mut: bool,
|
||||
pub lifetime: Option<trap::Label<Lifetime>>,
|
||||
pub name: Option<trap::Label<Name>>,
|
||||
pub ty: Option<trap::Label<TypeRef>>,
|
||||
@@ -2087,6 +2092,9 @@ impl trap::TrapEntry for SelfParam {
|
||||
for (i, v) in self.attrs.into_iter().enumerate() {
|
||||
out.add_tuple("self_param_attrs", vec![id.into(), i.into(), v.into()]);
|
||||
}
|
||||
if self.is_mut {
|
||||
out.add_tuple("self_param_is_mut", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.lifetime {
|
||||
out.add_tuple("self_param_lifetimes", vec![id.into(), v.into()]);
|
||||
}
|
||||
@@ -2422,6 +2430,8 @@ impl From<trap::Label<TupleField>> for trap::Label<Locatable> {
|
||||
pub struct TypeBound {
|
||||
pub id: trap::TrapId<TypeBound>,
|
||||
pub generic_param_list: Option<trap::Label<GenericParamList>>,
|
||||
pub is_async: bool,
|
||||
pub is_const: bool,
|
||||
pub lifetime: Option<trap::Label<Lifetime>>,
|
||||
pub ty: Option<trap::Label<TypeRef>>,
|
||||
}
|
||||
@@ -2436,6 +2446,12 @@ impl trap::TrapEntry for TypeBound {
|
||||
if let Some(v) = self.generic_param_list {
|
||||
out.add_tuple("type_bound_generic_param_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if self.is_async {
|
||||
out.add_tuple("type_bound_is_async", vec![id.into()]);
|
||||
}
|
||||
if self.is_const {
|
||||
out.add_tuple("type_bound_is_const", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.lifetime {
|
||||
out.add_tuple("type_bound_lifetimes", vec![id.into(), v.into()]);
|
||||
}
|
||||
@@ -3425,6 +3441,12 @@ impl From<trap::Label<BinaryExpr>> for trap::Label<Locatable> {
|
||||
pub struct BlockExpr {
|
||||
pub id: trap::TrapId<BlockExpr>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub is_async: bool,
|
||||
pub is_const: bool,
|
||||
pub is_gen: bool,
|
||||
pub is_move: bool,
|
||||
pub is_try: bool,
|
||||
pub is_unsafe: bool,
|
||||
pub label: Option<trap::Label<Label>>,
|
||||
pub stmt_list: Option<trap::Label<StmtList>>,
|
||||
}
|
||||
@@ -3439,6 +3461,24 @@ impl trap::TrapEntry for BlockExpr {
|
||||
for (i, v) in self.attrs.into_iter().enumerate() {
|
||||
out.add_tuple("block_expr_attrs", vec![id.into(), i.into(), v.into()]);
|
||||
}
|
||||
if self.is_async {
|
||||
out.add_tuple("block_expr_is_async", vec![id.into()]);
|
||||
}
|
||||
if self.is_const {
|
||||
out.add_tuple("block_expr_is_const", vec![id.into()]);
|
||||
}
|
||||
if self.is_gen {
|
||||
out.add_tuple("block_expr_is_gen", vec![id.into()]);
|
||||
}
|
||||
if self.is_move {
|
||||
out.add_tuple("block_expr_is_move", vec![id.into()]);
|
||||
}
|
||||
if self.is_try {
|
||||
out.add_tuple("block_expr_is_try", vec![id.into()]);
|
||||
}
|
||||
if self.is_unsafe {
|
||||
out.add_tuple("block_expr_is_unsafe", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.label {
|
||||
out.add_tuple("block_expr_labels", vec![id.into(), v.into()]);
|
||||
}
|
||||
@@ -3732,6 +3772,11 @@ pub struct ClosureExpr {
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub body: Option<trap::Label<Expr>>,
|
||||
pub closure_binder: Option<trap::Label<ClosureBinder>>,
|
||||
pub is_async: bool,
|
||||
pub is_const: bool,
|
||||
pub is_gen: bool,
|
||||
pub is_move: bool,
|
||||
pub is_static: bool,
|
||||
pub param_list: Option<trap::Label<ParamList>>,
|
||||
pub ret_type: Option<trap::Label<RetType>>,
|
||||
}
|
||||
@@ -3752,6 +3797,21 @@ impl trap::TrapEntry for ClosureExpr {
|
||||
if let Some(v) = self.closure_binder {
|
||||
out.add_tuple("closure_expr_closure_binders", vec![id.into(), v.into()]);
|
||||
}
|
||||
if self.is_async {
|
||||
out.add_tuple("closure_expr_is_async", vec![id.into()]);
|
||||
}
|
||||
if self.is_const {
|
||||
out.add_tuple("closure_expr_is_const", vec![id.into()]);
|
||||
}
|
||||
if self.is_gen {
|
||||
out.add_tuple("closure_expr_is_gen", vec![id.into()]);
|
||||
}
|
||||
if self.is_move {
|
||||
out.add_tuple("closure_expr_is_move", vec![id.into()]);
|
||||
}
|
||||
if self.is_static {
|
||||
out.add_tuple("closure_expr_is_static", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.param_list {
|
||||
out.add_tuple("closure_expr_param_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
@@ -3921,6 +3981,7 @@ impl From<trap::Label<ConstArg>> for trap::Label<Locatable> {
|
||||
pub struct ConstBlockPat {
|
||||
pub id: trap::TrapId<ConstBlockPat>,
|
||||
pub block_expr: Option<trap::Label<BlockExpr>>,
|
||||
pub is_const: bool,
|
||||
}
|
||||
|
||||
impl trap::TrapEntry for ConstBlockPat {
|
||||
@@ -3933,6 +3994,9 @@ impl trap::TrapEntry for ConstBlockPat {
|
||||
if let Some(v) = self.block_expr {
|
||||
out.add_tuple("const_block_pat_block_exprs", vec![id.into(), v.into()]);
|
||||
}
|
||||
if self.is_const {
|
||||
out.add_tuple("const_block_pat_is_const", vec![id.into()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3981,6 +4045,7 @@ pub struct ConstParam {
|
||||
pub id: trap::TrapId<ConstParam>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub default_val: Option<trap::Label<ConstArg>>,
|
||||
pub is_const: bool,
|
||||
pub name: Option<trap::Label<Name>>,
|
||||
pub ty: Option<trap::Label<TypeRef>>,
|
||||
}
|
||||
@@ -3998,6 +4063,9 @@ impl trap::TrapEntry for ConstParam {
|
||||
if let Some(v) = self.default_val {
|
||||
out.add_tuple("const_param_default_vals", vec![id.into(), v.into()]);
|
||||
}
|
||||
if self.is_const {
|
||||
out.add_tuple("const_param_is_const", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.name {
|
||||
out.add_tuple("const_param_names", vec![id.into(), v.into()]);
|
||||
}
|
||||
@@ -4299,6 +4367,9 @@ impl From<trap::Label<FieldExpr>> for trap::Label<Locatable> {
|
||||
pub struct FnPtrType {
|
||||
pub id: trap::TrapId<FnPtrType>,
|
||||
pub abi: Option<trap::Label<Abi>>,
|
||||
pub is_async: bool,
|
||||
pub is_const: bool,
|
||||
pub is_unsafe: bool,
|
||||
pub param_list: Option<trap::Label<ParamList>>,
|
||||
pub ret_type: Option<trap::Label<RetType>>,
|
||||
}
|
||||
@@ -4313,6 +4384,15 @@ impl trap::TrapEntry for FnPtrType {
|
||||
if let Some(v) = self.abi {
|
||||
out.add_tuple("fn_ptr_type_abis", vec![id.into(), v.into()]);
|
||||
}
|
||||
if self.is_async {
|
||||
out.add_tuple("fn_ptr_type_is_async", vec![id.into()]);
|
||||
}
|
||||
if self.is_const {
|
||||
out.add_tuple("fn_ptr_type_is_const", vec![id.into()]);
|
||||
}
|
||||
if self.is_unsafe {
|
||||
out.add_tuple("fn_ptr_type_is_unsafe", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.param_list {
|
||||
out.add_tuple("fn_ptr_type_param_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
@@ -4571,6 +4651,8 @@ impl From<trap::Label<FormatArgsExpr>> for trap::Label<Locatable> {
|
||||
pub struct IdentPat {
|
||||
pub id: trap::TrapId<IdentPat>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub is_mut: bool,
|
||||
pub is_ref: bool,
|
||||
pub name: Option<trap::Label<Name>>,
|
||||
pub pat: Option<trap::Label<Pat>>,
|
||||
}
|
||||
@@ -4585,6 +4667,12 @@ impl trap::TrapEntry for IdentPat {
|
||||
for (i, v) in self.attrs.into_iter().enumerate() {
|
||||
out.add_tuple("ident_pat_attrs", vec![id.into(), i.into(), v.into()]);
|
||||
}
|
||||
if self.is_mut {
|
||||
out.add_tuple("ident_pat_is_mut", vec![id.into()]);
|
||||
}
|
||||
if self.is_ref {
|
||||
out.add_tuple("ident_pat_is_ref", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.name {
|
||||
out.add_tuple("ident_pat_names", vec![id.into(), v.into()]);
|
||||
}
|
||||
@@ -6245,6 +6333,8 @@ impl From<trap::Label<PrefixExpr>> for trap::Label<Locatable> {
|
||||
#[derive(Debug)]
|
||||
pub struct PtrType {
|
||||
pub id: trap::TrapId<PtrType>,
|
||||
pub is_const: bool,
|
||||
pub is_mut: bool,
|
||||
pub ty: Option<trap::Label<TypeRef>>,
|
||||
}
|
||||
|
||||
@@ -6255,6 +6345,12 @@ impl trap::TrapEntry for PtrType {
|
||||
|
||||
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
|
||||
out.add_tuple("ptr_types", vec![id.into()]);
|
||||
if self.is_const {
|
||||
out.add_tuple("ptr_type_is_const", vec![id.into()]);
|
||||
}
|
||||
if self.is_mut {
|
||||
out.add_tuple("ptr_type_is_mut", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.ty {
|
||||
out.add_tuple("ptr_type_ties", vec![id.into(), v.into()]);
|
||||
}
|
||||
@@ -6629,6 +6725,9 @@ pub struct RefExpr {
|
||||
pub id: trap::TrapId<RefExpr>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub expr: Option<trap::Label<Expr>>,
|
||||
pub is_const: bool,
|
||||
pub is_mut: bool,
|
||||
pub is_raw: bool,
|
||||
}
|
||||
|
||||
impl trap::TrapEntry for RefExpr {
|
||||
@@ -6644,6 +6743,15 @@ impl trap::TrapEntry for RefExpr {
|
||||
if let Some(v) = self.expr {
|
||||
out.add_tuple("ref_expr_exprs", vec![id.into(), v.into()]);
|
||||
}
|
||||
if self.is_const {
|
||||
out.add_tuple("ref_expr_is_const", vec![id.into()]);
|
||||
}
|
||||
if self.is_mut {
|
||||
out.add_tuple("ref_expr_is_mut", vec![id.into()]);
|
||||
}
|
||||
if self.is_raw {
|
||||
out.add_tuple("ref_expr_is_raw", vec![id.into()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6690,6 +6798,7 @@ impl From<trap::Label<RefExpr>> for trap::Label<Locatable> {
|
||||
#[derive(Debug)]
|
||||
pub struct RefPat {
|
||||
pub id: trap::TrapId<RefPat>,
|
||||
pub is_mut: bool,
|
||||
pub pat: Option<trap::Label<Pat>>,
|
||||
}
|
||||
|
||||
@@ -6700,6 +6809,9 @@ impl trap::TrapEntry for RefPat {
|
||||
|
||||
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
|
||||
out.add_tuple("ref_pats", vec![id.into()]);
|
||||
if self.is_mut {
|
||||
out.add_tuple("ref_pat_is_mut", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.pat {
|
||||
out.add_tuple("ref_pat_pats", vec![id.into(), v.into()]);
|
||||
}
|
||||
@@ -6749,6 +6861,7 @@ impl From<trap::Label<RefPat>> for trap::Label<Pat> {
|
||||
#[derive(Debug)]
|
||||
pub struct RefType {
|
||||
pub id: trap::TrapId<RefType>,
|
||||
pub is_mut: bool,
|
||||
pub lifetime: Option<trap::Label<Lifetime>>,
|
||||
pub ty: Option<trap::Label<TypeRef>>,
|
||||
}
|
||||
@@ -6760,6 +6873,9 @@ impl trap::TrapEntry for RefType {
|
||||
|
||||
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
|
||||
out.add_tuple("ref_types", vec![id.into()]);
|
||||
if self.is_mut {
|
||||
out.add_tuple("ref_type_is_mut", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.lifetime {
|
||||
out.add_tuple("ref_type_lifetimes", vec![id.into(), v.into()]);
|
||||
}
|
||||
@@ -7937,6 +8053,8 @@ pub struct Const {
|
||||
pub id: trap::TrapId<Const>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub body: Option<trap::Label<Expr>>,
|
||||
pub is_const: bool,
|
||||
pub is_default: bool,
|
||||
pub name: Option<trap::Label<Name>>,
|
||||
pub ty: Option<trap::Label<TypeRef>>,
|
||||
pub visibility: Option<trap::Label<Visibility>>,
|
||||
@@ -7955,6 +8073,12 @@ impl trap::TrapEntry for Const {
|
||||
if let Some(v) = self.body {
|
||||
out.add_tuple("const_bodies", vec![id.into(), v.into()]);
|
||||
}
|
||||
if self.is_const {
|
||||
out.add_tuple("const_is_const", vec![id.into()]);
|
||||
}
|
||||
if self.is_default {
|
||||
out.add_tuple("const_is_default", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.name {
|
||||
out.add_tuple("const_names", vec![id.into(), v.into()]);
|
||||
}
|
||||
@@ -8119,6 +8243,7 @@ pub struct ExternBlock {
|
||||
pub abi: Option<trap::Label<Abi>>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub extern_item_list: Option<trap::Label<ExternItemList>>,
|
||||
pub is_unsafe: bool,
|
||||
}
|
||||
|
||||
impl trap::TrapEntry for ExternBlock {
|
||||
@@ -8137,6 +8262,9 @@ impl trap::TrapEntry for ExternBlock {
|
||||
if let Some(v) = self.extern_item_list {
|
||||
out.add_tuple("extern_block_extern_item_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if self.is_unsafe {
|
||||
out.add_tuple("extern_block_is_unsafe", vec![id.into()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8276,6 +8404,11 @@ pub struct Function {
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub body: Option<trap::Label<BlockExpr>>,
|
||||
pub generic_param_list: Option<trap::Label<GenericParamList>>,
|
||||
pub is_async: bool,
|
||||
pub is_const: bool,
|
||||
pub is_default: bool,
|
||||
pub is_gen: bool,
|
||||
pub is_unsafe: bool,
|
||||
pub name: Option<trap::Label<Name>>,
|
||||
pub param_list: Option<trap::Label<ParamList>>,
|
||||
pub ret_type: Option<trap::Label<RetType>>,
|
||||
@@ -8302,6 +8435,21 @@ impl trap::TrapEntry for Function {
|
||||
if let Some(v) = self.generic_param_list {
|
||||
out.add_tuple("function_generic_param_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if self.is_async {
|
||||
out.add_tuple("function_is_async", vec![id.into()]);
|
||||
}
|
||||
if self.is_const {
|
||||
out.add_tuple("function_is_const", vec![id.into()]);
|
||||
}
|
||||
if self.is_default {
|
||||
out.add_tuple("function_is_default", vec![id.into()]);
|
||||
}
|
||||
if self.is_gen {
|
||||
out.add_tuple("function_is_gen", vec![id.into()]);
|
||||
}
|
||||
if self.is_unsafe {
|
||||
out.add_tuple("function_is_unsafe", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.name {
|
||||
out.add_tuple("function_names", vec![id.into(), v.into()]);
|
||||
}
|
||||
@@ -8393,6 +8541,9 @@ pub struct Impl {
|
||||
pub assoc_item_list: Option<trap::Label<AssocItemList>>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub generic_param_list: Option<trap::Label<GenericParamList>>,
|
||||
pub is_const: bool,
|
||||
pub is_default: bool,
|
||||
pub is_unsafe: bool,
|
||||
pub self_ty: Option<trap::Label<TypeRef>>,
|
||||
pub trait_: Option<trap::Label<TypeRef>>,
|
||||
pub visibility: Option<trap::Label<Visibility>>,
|
||||
@@ -8415,6 +8566,15 @@ impl trap::TrapEntry for Impl {
|
||||
if let Some(v) = self.generic_param_list {
|
||||
out.add_tuple("impl_generic_param_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if self.is_const {
|
||||
out.add_tuple("impl_is_const", vec![id.into()]);
|
||||
}
|
||||
if self.is_default {
|
||||
out.add_tuple("impl_is_default", vec![id.into()]);
|
||||
}
|
||||
if self.is_unsafe {
|
||||
out.add_tuple("impl_is_unsafe", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.self_ty {
|
||||
out.add_tuple("impl_self_ties", vec![id.into(), v.into()]);
|
||||
}
|
||||
@@ -8906,6 +9066,8 @@ pub struct Static {
|
||||
pub id: trap::TrapId<Static>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub body: Option<trap::Label<Expr>>,
|
||||
pub is_mut: bool,
|
||||
pub is_static: bool,
|
||||
pub name: Option<trap::Label<Name>>,
|
||||
pub ty: Option<trap::Label<TypeRef>>,
|
||||
pub visibility: Option<trap::Label<Visibility>>,
|
||||
@@ -8924,6 +9086,12 @@ impl trap::TrapEntry for Static {
|
||||
if let Some(v) = self.body {
|
||||
out.add_tuple("static_bodies", vec![id.into(), v.into()]);
|
||||
}
|
||||
if self.is_mut {
|
||||
out.add_tuple("static_is_mut", vec![id.into()]);
|
||||
}
|
||||
if self.is_static {
|
||||
out.add_tuple("static_is_static", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.name {
|
||||
out.add_tuple("static_names", vec![id.into(), v.into()]);
|
||||
}
|
||||
@@ -9088,6 +9256,8 @@ pub struct Trait {
|
||||
pub assoc_item_list: Option<trap::Label<AssocItemList>>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub generic_param_list: Option<trap::Label<GenericParamList>>,
|
||||
pub is_auto: bool,
|
||||
pub is_unsafe: bool,
|
||||
pub name: Option<trap::Label<Name>>,
|
||||
pub type_bound_list: Option<trap::Label<TypeBoundList>>,
|
||||
pub visibility: Option<trap::Label<Visibility>>,
|
||||
@@ -9110,6 +9280,12 @@ impl trap::TrapEntry for Trait {
|
||||
if let Some(v) = self.generic_param_list {
|
||||
out.add_tuple("trait_generic_param_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if self.is_auto {
|
||||
out.add_tuple("trait_is_auto", vec![id.into()]);
|
||||
}
|
||||
if self.is_unsafe {
|
||||
out.add_tuple("trait_is_unsafe", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.name {
|
||||
out.add_tuple("trait_names", vec![id.into(), v.into()]);
|
||||
}
|
||||
@@ -9267,6 +9443,7 @@ pub struct TypeAlias {
|
||||
pub id: trap::TrapId<TypeAlias>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub generic_param_list: Option<trap::Label<GenericParamList>>,
|
||||
pub is_default: bool,
|
||||
pub name: Option<trap::Label<Name>>,
|
||||
pub ty: Option<trap::Label<TypeRef>>,
|
||||
pub type_bound_list: Option<trap::Label<TypeBoundList>>,
|
||||
@@ -9287,6 +9464,9 @@ impl trap::TrapEntry for TypeAlias {
|
||||
if let Some(v) = self.generic_param_list {
|
||||
out.add_tuple("type_alias_generic_param_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if self.is_default {
|
||||
out.add_tuple("type_alias_is_default", vec![id.into()]);
|
||||
}
|
||||
if let Some(v) = self.name {
|
||||
out.add_tuple("type_alias_names", vec![id.into(), v.into()]);
|
||||
}
|
||||
|
||||
90
rust/extractor/src/translate/generated.rs
generated
90
rust/extractor/src/translate/generated.rs
generated
@@ -327,11 +327,23 @@ impl Translator {
|
||||
|
||||
pub(crate) fn emit_block_expr(&mut self, node: ast::BlockExpr) -> Label<generated::BlockExpr> {
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let is_async = node.async_token().is_some();
|
||||
let is_const = node.const_token().is_some();
|
||||
let is_gen = node.gen_token().is_some();
|
||||
let is_move = node.move_token().is_some();
|
||||
let is_try = node.try_token().is_some();
|
||||
let is_unsafe = node.unsafe_token().is_some();
|
||||
let label = node.label().map(|x| self.emit_label(x));
|
||||
let stmt_list = node.stmt_list().map(|x| self.emit_stmt_list(x));
|
||||
let label = self.trap.emit(generated::BlockExpr {
|
||||
id: TrapId::Star,
|
||||
attrs,
|
||||
is_async,
|
||||
is_const,
|
||||
is_gen,
|
||||
is_move,
|
||||
is_try,
|
||||
is_unsafe,
|
||||
label,
|
||||
stmt_list,
|
||||
});
|
||||
@@ -411,6 +423,11 @@ impl Translator {
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let body = node.body().map(|x| self.emit_expr(x));
|
||||
let closure_binder = node.closure_binder().map(|x| self.emit_closure_binder(x));
|
||||
let is_async = node.async_token().is_some();
|
||||
let is_const = node.const_token().is_some();
|
||||
let is_gen = node.gen_token().is_some();
|
||||
let is_move = node.move_token().is_some();
|
||||
let is_static = node.static_token().is_some();
|
||||
let param_list = node.param_list().map(|x| self.emit_param_list(x));
|
||||
let ret_type = node.ret_type().map(|x| self.emit_ret_type(x));
|
||||
let label = self.trap.emit(generated::ClosureExpr {
|
||||
@@ -418,6 +435,11 @@ impl Translator {
|
||||
attrs,
|
||||
body,
|
||||
closure_binder,
|
||||
is_async,
|
||||
is_const,
|
||||
is_gen,
|
||||
is_move,
|
||||
is_static,
|
||||
param_list,
|
||||
ret_type,
|
||||
});
|
||||
@@ -429,6 +451,8 @@ impl Translator {
|
||||
pub(crate) fn emit_const(&mut self, node: ast::Const) -> Label<generated::Const> {
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let body = node.body().map(|x| self.emit_expr(x));
|
||||
let is_const = node.const_token().is_some();
|
||||
let is_default = node.default_token().is_some();
|
||||
let name = node.name().map(|x| self.emit_name(x));
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let visibility = node.visibility().map(|x| self.emit_visibility(x));
|
||||
@@ -436,6 +460,8 @@ impl Translator {
|
||||
id: TrapId::Star,
|
||||
attrs,
|
||||
body,
|
||||
is_const,
|
||||
is_default,
|
||||
name,
|
||||
ty,
|
||||
visibility,
|
||||
@@ -458,9 +484,11 @@ impl Translator {
|
||||
|
||||
pub(crate) fn emit_const_block_pat(&mut self, node: ast::ConstBlockPat) -> Label<generated::ConstBlockPat> {
|
||||
let block_expr = node.block_expr().map(|x| self.emit_block_expr(x));
|
||||
let is_const = node.const_token().is_some();
|
||||
let label = self.trap.emit(generated::ConstBlockPat {
|
||||
id: TrapId::Star,
|
||||
block_expr,
|
||||
is_const,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
self.emit_tokens(label.into(), node.syntax().children_with_tokens());
|
||||
@@ -470,12 +498,14 @@ impl Translator {
|
||||
pub(crate) fn emit_const_param(&mut self, node: ast::ConstParam) -> Label<generated::ConstParam> {
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let default_val = node.default_val().map(|x| self.emit_const_arg(x));
|
||||
let is_const = node.const_token().is_some();
|
||||
let name = node.name().map(|x| self.emit_name(x));
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::ConstParam {
|
||||
id: TrapId::Star,
|
||||
attrs,
|
||||
default_val,
|
||||
is_const,
|
||||
name,
|
||||
ty,
|
||||
});
|
||||
@@ -544,11 +574,13 @@ impl Translator {
|
||||
let abi = node.abi().map(|x| self.emit_abi(x));
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let extern_item_list = node.extern_item_list().map(|x| self.emit_extern_item_list(x));
|
||||
let is_unsafe = node.unsafe_token().is_some();
|
||||
let label = self.trap.emit(generated::ExternBlock {
|
||||
id: TrapId::Star,
|
||||
abi,
|
||||
attrs,
|
||||
extern_item_list,
|
||||
is_unsafe,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
self.emit_tokens(label.into(), node.syntax().children_with_tokens());
|
||||
@@ -605,6 +637,11 @@ impl Translator {
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let body = node.body().map(|x| self.emit_block_expr(x));
|
||||
let generic_param_list = node.generic_param_list().map(|x| self.emit_generic_param_list(x));
|
||||
let is_async = node.async_token().is_some();
|
||||
let is_const = node.const_token().is_some();
|
||||
let is_default = node.default_token().is_some();
|
||||
let is_gen = node.gen_token().is_some();
|
||||
let is_unsafe = node.unsafe_token().is_some();
|
||||
let name = node.name().map(|x| self.emit_name(x));
|
||||
let param_list = node.param_list().map(|x| self.emit_param_list(x));
|
||||
let ret_type = node.ret_type().map(|x| self.emit_ret_type(x));
|
||||
@@ -616,6 +653,11 @@ impl Translator {
|
||||
attrs,
|
||||
body,
|
||||
generic_param_list,
|
||||
is_async,
|
||||
is_const,
|
||||
is_default,
|
||||
is_gen,
|
||||
is_unsafe,
|
||||
name,
|
||||
param_list,
|
||||
ret_type,
|
||||
@@ -629,11 +671,17 @@ impl Translator {
|
||||
|
||||
pub(crate) fn emit_fn_ptr_type(&mut self, node: ast::FnPtrType) -> Label<generated::FnPtrType> {
|
||||
let abi = node.abi().map(|x| self.emit_abi(x));
|
||||
let is_async = node.async_token().is_some();
|
||||
let is_const = node.const_token().is_some();
|
||||
let is_unsafe = node.unsafe_token().is_some();
|
||||
let param_list = node.param_list().map(|x| self.emit_param_list(x));
|
||||
let ret_type = node.ret_type().map(|x| self.emit_ret_type(x));
|
||||
let label = self.trap.emit(generated::FnPtrType {
|
||||
id: TrapId::Star,
|
||||
abi,
|
||||
is_async,
|
||||
is_const,
|
||||
is_unsafe,
|
||||
param_list,
|
||||
ret_type,
|
||||
});
|
||||
@@ -726,11 +774,15 @@ impl Translator {
|
||||
|
||||
pub(crate) fn emit_ident_pat(&mut self, node: ast::IdentPat) -> Label<generated::IdentPat> {
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let is_mut = node.mut_token().is_some();
|
||||
let is_ref = node.ref_token().is_some();
|
||||
let name = node.name().map(|x| self.emit_name(x));
|
||||
let pat = node.pat().map(|x| self.emit_pat(x));
|
||||
let label = self.trap.emit(generated::IdentPat {
|
||||
id: TrapId::Star,
|
||||
attrs,
|
||||
is_mut,
|
||||
is_ref,
|
||||
name,
|
||||
pat,
|
||||
});
|
||||
@@ -760,6 +812,9 @@ impl Translator {
|
||||
let assoc_item_list = node.assoc_item_list().map(|x| self.emit_assoc_item_list(x));
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let generic_param_list = node.generic_param_list().map(|x| self.emit_generic_param_list(x));
|
||||
let is_const = node.const_token().is_some();
|
||||
let is_default = node.default_token().is_some();
|
||||
let is_unsafe = node.unsafe_token().is_some();
|
||||
let self_ty = node.self_ty().map(|x| self.emit_type(x));
|
||||
let trait_ = node.trait_().map(|x| self.emit_type(x));
|
||||
let visibility = node.visibility().map(|x| self.emit_visibility(x));
|
||||
@@ -769,6 +824,9 @@ impl Translator {
|
||||
assoc_item_list,
|
||||
attrs,
|
||||
generic_param_list,
|
||||
is_const,
|
||||
is_default,
|
||||
is_unsafe,
|
||||
self_ty,
|
||||
trait_,
|
||||
visibility,
|
||||
@@ -1101,11 +1159,13 @@ impl Translator {
|
||||
|
||||
pub(crate) fn emit_meta(&mut self, node: ast::Meta) -> Label<generated::Meta> {
|
||||
let expr = node.expr().map(|x| self.emit_expr(x));
|
||||
let is_unsafe = node.unsafe_token().is_some();
|
||||
let path = node.path().map(|x| self.emit_path(x));
|
||||
let token_tree = node.token_tree().map(|x| self.emit_token_tree(x));
|
||||
let label = self.trap.emit(generated::Meta {
|
||||
id: TrapId::Star,
|
||||
expr,
|
||||
is_unsafe,
|
||||
path,
|
||||
token_tree,
|
||||
});
|
||||
@@ -1357,9 +1417,13 @@ impl Translator {
|
||||
}
|
||||
|
||||
pub(crate) fn emit_ptr_type(&mut self, node: ast::PtrType) -> Label<generated::PtrType> {
|
||||
let is_const = node.const_token().is_some();
|
||||
let is_mut = node.mut_token().is_some();
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::PtrType {
|
||||
id: TrapId::Star,
|
||||
is_const,
|
||||
is_mut,
|
||||
ty,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
@@ -1514,10 +1578,16 @@ impl Translator {
|
||||
pub(crate) fn emit_ref_expr(&mut self, node: ast::RefExpr) -> Label<generated::RefExpr> {
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let expr = node.expr().map(|x| self.emit_expr(x));
|
||||
let is_const = node.const_token().is_some();
|
||||
let is_mut = node.mut_token().is_some();
|
||||
let is_raw = node.raw_token().is_some();
|
||||
let label = self.trap.emit(generated::RefExpr {
|
||||
id: TrapId::Star,
|
||||
attrs,
|
||||
expr,
|
||||
is_const,
|
||||
is_mut,
|
||||
is_raw,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
self.emit_tokens(label.into(), node.syntax().children_with_tokens());
|
||||
@@ -1525,9 +1595,11 @@ impl Translator {
|
||||
}
|
||||
|
||||
pub(crate) fn emit_ref_pat(&mut self, node: ast::RefPat) -> Label<generated::RefPat> {
|
||||
let is_mut = node.mut_token().is_some();
|
||||
let pat = node.pat().map(|x| self.emit_pat(x));
|
||||
let label = self.trap.emit(generated::RefPat {
|
||||
id: TrapId::Star,
|
||||
is_mut,
|
||||
pat,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
@@ -1536,10 +1608,12 @@ impl Translator {
|
||||
}
|
||||
|
||||
pub(crate) fn emit_ref_type(&mut self, node: ast::RefType) -> Label<generated::RefType> {
|
||||
let is_mut = node.mut_token().is_some();
|
||||
let lifetime = node.lifetime().map(|x| self.emit_lifetime(x));
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::RefType {
|
||||
id: TrapId::Star,
|
||||
is_mut,
|
||||
lifetime,
|
||||
ty,
|
||||
});
|
||||
@@ -1605,12 +1679,14 @@ impl Translator {
|
||||
|
||||
pub(crate) fn emit_self_param(&mut self, node: ast::SelfParam) -> Label<generated::SelfParam> {
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let is_mut = node.mut_token().is_some();
|
||||
let lifetime = node.lifetime().map(|x| self.emit_lifetime(x));
|
||||
let name = node.name().map(|x| self.emit_name(x));
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::SelfParam {
|
||||
id: TrapId::Star,
|
||||
attrs,
|
||||
is_mut,
|
||||
lifetime,
|
||||
name,
|
||||
ty,
|
||||
@@ -1658,6 +1734,8 @@ impl Translator {
|
||||
pub(crate) fn emit_static(&mut self, node: ast::Static) -> Label<generated::Static> {
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let body = node.body().map(|x| self.emit_expr(x));
|
||||
let is_mut = node.mut_token().is_some();
|
||||
let is_static = node.static_token().is_some();
|
||||
let name = node.name().map(|x| self.emit_name(x));
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let visibility = node.visibility().map(|x| self.emit_visibility(x));
|
||||
@@ -1665,6 +1743,8 @@ impl Translator {
|
||||
id: TrapId::Star,
|
||||
attrs,
|
||||
body,
|
||||
is_mut,
|
||||
is_static,
|
||||
name,
|
||||
ty,
|
||||
visibility,
|
||||
@@ -1723,6 +1803,8 @@ impl Translator {
|
||||
let assoc_item_list = node.assoc_item_list().map(|x| self.emit_assoc_item_list(x));
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let generic_param_list = node.generic_param_list().map(|x| self.emit_generic_param_list(x));
|
||||
let is_auto = node.auto_token().is_some();
|
||||
let is_unsafe = node.unsafe_token().is_some();
|
||||
let name = node.name().map(|x| self.emit_name(x));
|
||||
let type_bound_list = node.type_bound_list().map(|x| self.emit_type_bound_list(x));
|
||||
let visibility = node.visibility().map(|x| self.emit_visibility(x));
|
||||
@@ -1732,6 +1814,8 @@ impl Translator {
|
||||
assoc_item_list,
|
||||
attrs,
|
||||
generic_param_list,
|
||||
is_auto,
|
||||
is_unsafe,
|
||||
name,
|
||||
type_bound_list,
|
||||
visibility,
|
||||
@@ -1853,6 +1937,7 @@ impl Translator {
|
||||
pub(crate) fn emit_type_alias(&mut self, node: ast::TypeAlias) -> Label<generated::TypeAlias> {
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let generic_param_list = node.generic_param_list().map(|x| self.emit_generic_param_list(x));
|
||||
let is_default = node.default_token().is_some();
|
||||
let name = node.name().map(|x| self.emit_name(x));
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let type_bound_list = node.type_bound_list().map(|x| self.emit_type_bound_list(x));
|
||||
@@ -1862,6 +1947,7 @@ impl Translator {
|
||||
id: TrapId::Star,
|
||||
attrs,
|
||||
generic_param_list,
|
||||
is_default,
|
||||
name,
|
||||
ty,
|
||||
type_bound_list,
|
||||
@@ -1886,11 +1972,15 @@ impl Translator {
|
||||
|
||||
pub(crate) fn emit_type_bound(&mut self, node: ast::TypeBound) -> Label<generated::TypeBound> {
|
||||
let generic_param_list = node.generic_param_list().map(|x| self.emit_generic_param_list(x));
|
||||
let is_async = node.async_token().is_some();
|
||||
let is_const = node.const_token().is_some();
|
||||
let lifetime = node.lifetime().map(|x| self.emit_lifetime(x));
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::TypeBound {
|
||||
id: TrapId::Star,
|
||||
generic_param_list,
|
||||
is_async,
|
||||
is_const,
|
||||
lifetime,
|
||||
ty,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user