mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
Merge branch 'main' into redsun82/rust-less-canonical-paths
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 6a10ed08afcc3a92154d3cf8a8cf7de7a27766b5f2ff7a64960d9f9ca0e51fb6 6a10ed08afcc3a92154d3cf8a8cf7de7a27766b5f2ff7a64960d9f9ca0e51fb6
|
||||
top.rs e0e5e208e1fa42245e8d76bb420a89cb7f357fcc6228683db25aeb9ac057a5b9 e0e5e208e1fa42245e8d76bb420a89cb7f357fcc6228683db25aeb9ac057a5b9
|
||||
|
||||
750
rust/extractor/src/generated/top.rs
generated
750
rust/extractor/src/generated/top.rs
generated
File diff suppressed because it is too large
Load Diff
184
rust/extractor/src/translate/generated.rs
generated
184
rust/extractor/src/translate/generated.rs
generated
@@ -133,7 +133,7 @@ impl Translator<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn emit_type(&mut self, node: ast::Type) -> Label<generated::TypeRef> {
|
||||
pub(crate) fn emit_type(&mut self, node: ast::Type) -> Label<generated::TypeRepr> {
|
||||
match node {
|
||||
ast::Type::ArrayType(inner) => self.emit_array_type(inner).into(),
|
||||
ast::Type::DynTraitType(inner) => self.emit_dyn_trait_type(inner).into(),
|
||||
@@ -214,16 +214,16 @@ impl Translator<'_> {
|
||||
label
|
||||
}
|
||||
|
||||
pub(crate) fn emit_array_type(&mut self, node: ast::ArrayType) -> Label<generated::ArrayType> {
|
||||
pub(crate) fn emit_array_type(&mut self, node: ast::ArrayType) -> Label<generated::ArrayTypeRepr> {
|
||||
let const_arg = node.const_arg().map(|x| self.emit_const_arg(x));
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::ArrayType {
|
||||
let element_type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::ArrayTypeRepr {
|
||||
id: TrapId::Star,
|
||||
const_arg,
|
||||
ty,
|
||||
element_type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(ArrayType, self, node, label);
|
||||
emit_detached!(ArrayTypeRepr, self, node, label);
|
||||
self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());
|
||||
label
|
||||
}
|
||||
@@ -263,7 +263,7 @@ impl Translator<'_> {
|
||||
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 return_type_syntax = node.return_type_syntax().map(|x| self.emit_return_type_syntax(x));
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let type_bound_list = node.type_bound_list().map(|x| self.emit_type_bound_list(x));
|
||||
let label = self.trap.emit(generated::AssocTypeArg {
|
||||
id: TrapId::Star,
|
||||
@@ -273,7 +273,7 @@ impl Translator<'_> {
|
||||
param_list,
|
||||
ret_type,
|
||||
return_type_syntax,
|
||||
ty,
|
||||
type_repr,
|
||||
type_bound_list,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
@@ -415,12 +415,12 @@ impl Translator<'_> {
|
||||
pub(crate) fn emit_cast_expr(&mut self, node: ast::CastExpr) -> Label<generated::CastExpr> {
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let expr = node.expr().map(|x| self.emit_expr(x));
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::CastExpr {
|
||||
id: TrapId::Star,
|
||||
attrs,
|
||||
expr,
|
||||
ty,
|
||||
type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(CastExpr, self, node, label);
|
||||
@@ -476,7 +476,7 @@ impl Translator<'_> {
|
||||
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 type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let visibility = node.visibility().map(|x| self.emit_visibility(x));
|
||||
let label = self.trap.emit(generated::Const {
|
||||
id: TrapId::Star,
|
||||
@@ -485,7 +485,7 @@ impl Translator<'_> {
|
||||
is_const,
|
||||
is_default,
|
||||
name,
|
||||
ty,
|
||||
type_repr,
|
||||
visibility,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
@@ -525,14 +525,14 @@ impl Translator<'_> {
|
||||
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 type_repr = 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,
|
||||
type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(ConstParam, self, node, label);
|
||||
@@ -554,14 +554,14 @@ impl Translator<'_> {
|
||||
label
|
||||
}
|
||||
|
||||
pub(crate) fn emit_dyn_trait_type(&mut self, node: ast::DynTraitType) -> Label<generated::DynTraitType> {
|
||||
pub(crate) fn emit_dyn_trait_type(&mut self, node: ast::DynTraitType) -> Label<generated::DynTraitTypeRepr> {
|
||||
let type_bound_list = node.type_bound_list().map(|x| self.emit_type_bound_list(x));
|
||||
let label = self.trap.emit(generated::DynTraitType {
|
||||
let label = self.trap.emit(generated::DynTraitTypeRepr {
|
||||
id: TrapId::Star,
|
||||
type_bound_list,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(DynTraitType, self, node, label);
|
||||
emit_detached!(DynTraitTypeRepr, self, node, label);
|
||||
self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());
|
||||
label
|
||||
}
|
||||
@@ -704,14 +704,14 @@ impl Translator<'_> {
|
||||
label
|
||||
}
|
||||
|
||||
pub(crate) fn emit_fn_ptr_type(&mut self, node: ast::FnPtrType) -> Label<generated::FnPtrType> {
|
||||
pub(crate) fn emit_fn_ptr_type(&mut self, node: ast::FnPtrType) -> Label<generated::FnPtrTypeRepr> {
|
||||
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 {
|
||||
let label = self.trap.emit(generated::FnPtrTypeRepr {
|
||||
id: TrapId::Star,
|
||||
abi,
|
||||
is_async,
|
||||
@@ -721,7 +721,7 @@ impl Translator<'_> {
|
||||
ret_type,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(FnPtrType, self, node, label);
|
||||
emit_detached!(FnPtrTypeRepr, self, node, label);
|
||||
self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());
|
||||
label
|
||||
}
|
||||
@@ -746,16 +746,16 @@ impl Translator<'_> {
|
||||
label
|
||||
}
|
||||
|
||||
pub(crate) fn emit_for_type(&mut self, node: ast::ForType) -> Label<generated::ForType> {
|
||||
pub(crate) fn emit_for_type(&mut self, node: ast::ForType) -> Label<generated::ForTypeRepr> {
|
||||
let generic_param_list = node.generic_param_list().map(|x| self.emit_generic_param_list(x));
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::ForType {
|
||||
let type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::ForTypeRepr {
|
||||
id: TrapId::Star,
|
||||
generic_param_list,
|
||||
ty,
|
||||
type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(ForType, self, node, label);
|
||||
emit_detached!(ForTypeRepr, self, node, label);
|
||||
self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());
|
||||
label
|
||||
}
|
||||
@@ -882,14 +882,14 @@ impl Translator<'_> {
|
||||
label
|
||||
}
|
||||
|
||||
pub(crate) fn emit_impl_trait_type(&mut self, node: ast::ImplTraitType) -> Label<generated::ImplTraitType> {
|
||||
pub(crate) fn emit_impl_trait_type(&mut self, node: ast::ImplTraitType) -> Label<generated::ImplTraitTypeRepr> {
|
||||
let type_bound_list = node.type_bound_list().map(|x| self.emit_type_bound_list(x));
|
||||
let label = self.trap.emit(generated::ImplTraitType {
|
||||
let label = self.trap.emit(generated::ImplTraitTypeRepr {
|
||||
id: TrapId::Star,
|
||||
type_bound_list,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(ImplTraitType, self, node, label);
|
||||
emit_detached!(ImplTraitTypeRepr, self, node, label);
|
||||
self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());
|
||||
label
|
||||
}
|
||||
@@ -910,12 +910,12 @@ impl Translator<'_> {
|
||||
label
|
||||
}
|
||||
|
||||
pub(crate) fn emit_infer_type(&mut self, node: ast::InferType) -> Label<generated::InferType> {
|
||||
let label = self.trap.emit(generated::InferType {
|
||||
pub(crate) fn emit_infer_type(&mut self, node: ast::InferType) -> Label<generated::InferTypeRepr> {
|
||||
let label = self.trap.emit(generated::InferTypeRepr {
|
||||
id: TrapId::Star,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(InferType, self, node, label);
|
||||
emit_detached!(InferTypeRepr, self, node, label);
|
||||
self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());
|
||||
label
|
||||
}
|
||||
@@ -979,14 +979,14 @@ impl Translator<'_> {
|
||||
let initializer = node.initializer().map(|x| self.emit_expr(x));
|
||||
let let_else = node.let_else().map(|x| self.emit_let_else(x));
|
||||
let pat = node.pat().map(|x| self.emit_pat(x));
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::LetStmt {
|
||||
id: TrapId::Star,
|
||||
attrs,
|
||||
initializer,
|
||||
let_else,
|
||||
pat,
|
||||
ty,
|
||||
type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(LetStmt, self, node, label);
|
||||
@@ -1180,14 +1180,14 @@ impl Translator<'_> {
|
||||
label
|
||||
}
|
||||
|
||||
pub(crate) fn emit_macro_type(&mut self, node: ast::MacroType) -> Label<generated::MacroType> {
|
||||
pub(crate) fn emit_macro_type(&mut self, node: ast::MacroType) -> Label<generated::MacroTypeRepr> {
|
||||
let macro_call = node.macro_call().map(|x| self.emit_macro_call(x));
|
||||
let label = self.trap.emit(generated::MacroType {
|
||||
let label = self.trap.emit(generated::MacroTypeRepr {
|
||||
id: TrapId::Star,
|
||||
macro_call,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(MacroType, self, node, label);
|
||||
emit_detached!(MacroTypeRepr, self, node, label);
|
||||
self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());
|
||||
label
|
||||
}
|
||||
@@ -1332,12 +1332,12 @@ impl Translator<'_> {
|
||||
label
|
||||
}
|
||||
|
||||
pub(crate) fn emit_never_type(&mut self, node: ast::NeverType) -> Label<generated::NeverType> {
|
||||
let label = self.trap.emit(generated::NeverType {
|
||||
pub(crate) fn emit_never_type(&mut self, node: ast::NeverType) -> Label<generated::NeverTypeRepr> {
|
||||
let label = self.trap.emit(generated::NeverTypeRepr {
|
||||
id: TrapId::Star,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(NeverType, self, node, label);
|
||||
emit_detached!(NeverTypeRepr, self, node, label);
|
||||
self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());
|
||||
label
|
||||
}
|
||||
@@ -1345,12 +1345,12 @@ impl Translator<'_> {
|
||||
pub(crate) fn emit_offset_of_expr(&mut self, node: ast::OffsetOfExpr) -> Label<generated::OffsetOfExpr> {
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let fields = node.fields().map(|x| self.emit_name_ref(x)).collect();
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::OffsetOfExpr {
|
||||
id: TrapId::Star,
|
||||
attrs,
|
||||
fields,
|
||||
ty,
|
||||
type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(OffsetOfExpr, self, node, label);
|
||||
@@ -1373,12 +1373,12 @@ impl Translator<'_> {
|
||||
pub(crate) fn emit_param(&mut self, node: ast::Param) -> Label<generated::Param> {
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let pat = node.pat().map(|x| self.emit_pat(x));
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::Param {
|
||||
id: TrapId::Star,
|
||||
attrs,
|
||||
pat,
|
||||
ty,
|
||||
type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(Param, self, node, label);
|
||||
@@ -1426,14 +1426,14 @@ impl Translator<'_> {
|
||||
label
|
||||
}
|
||||
|
||||
pub(crate) fn emit_paren_type(&mut self, node: ast::ParenType) -> Label<generated::ParenType> {
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::ParenType {
|
||||
pub(crate) fn emit_paren_type(&mut self, node: ast::ParenType) -> Label<generated::ParenTypeRepr> {
|
||||
let type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::ParenTypeRepr {
|
||||
id: TrapId::Star,
|
||||
ty,
|
||||
type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(ParenType, self, node, label);
|
||||
emit_detached!(ParenTypeRepr, self, node, label);
|
||||
self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());
|
||||
label
|
||||
}
|
||||
@@ -1485,7 +1485,7 @@ impl Translator<'_> {
|
||||
let path_type = node.path_type().map(|x| self.emit_path_type(x));
|
||||
let ret_type = node.ret_type().map(|x| self.emit_ret_type(x));
|
||||
let return_type_syntax = node.return_type_syntax().map(|x| self.emit_return_type_syntax(x));
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::PathSegment {
|
||||
id: TrapId::Star,
|
||||
generic_arg_list,
|
||||
@@ -1494,7 +1494,7 @@ impl Translator<'_> {
|
||||
path_type,
|
||||
ret_type,
|
||||
return_type_syntax,
|
||||
ty,
|
||||
type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(PathSegment, self, node, label);
|
||||
@@ -1502,14 +1502,14 @@ impl Translator<'_> {
|
||||
label
|
||||
}
|
||||
|
||||
pub(crate) fn emit_path_type(&mut self, node: ast::PathType) -> Label<generated::PathType> {
|
||||
pub(crate) fn emit_path_type(&mut self, node: ast::PathType) -> Label<generated::PathTypeRepr> {
|
||||
let path = node.path().map(|x| self.emit_path(x));
|
||||
let label = self.trap.emit(generated::PathType {
|
||||
let label = self.trap.emit(generated::PathTypeRepr {
|
||||
id: TrapId::Star,
|
||||
path,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(PathType, self, node, label);
|
||||
emit_detached!(PathTypeRepr, self, node, label);
|
||||
self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());
|
||||
label
|
||||
}
|
||||
@@ -1530,18 +1530,18 @@ impl Translator<'_> {
|
||||
label
|
||||
}
|
||||
|
||||
pub(crate) fn emit_ptr_type(&mut self, node: ast::PtrType) -> Label<generated::PtrType> {
|
||||
pub(crate) fn emit_ptr_type(&mut self, node: ast::PtrType) -> Label<generated::PtrTypeRepr> {
|
||||
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 {
|
||||
let type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::PtrTypeRepr {
|
||||
id: TrapId::Star,
|
||||
is_const,
|
||||
is_mut,
|
||||
ty,
|
||||
type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(PtrType, self, node, label);
|
||||
emit_detached!(PtrTypeRepr, self, node, label);
|
||||
self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());
|
||||
label
|
||||
}
|
||||
@@ -1629,13 +1629,13 @@ impl Translator<'_> {
|
||||
pub(crate) fn emit_record_field(&mut self, node: ast::RecordField) -> Label<generated::RecordField> {
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let name = node.name().map(|x| self.emit_name(x));
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let visibility = node.visibility().map(|x| self.emit_visibility(x));
|
||||
let label = self.trap.emit(generated::RecordField {
|
||||
id: TrapId::Star,
|
||||
attrs,
|
||||
name,
|
||||
ty,
|
||||
type_repr,
|
||||
visibility,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
@@ -1734,18 +1734,18 @@ impl Translator<'_> {
|
||||
label
|
||||
}
|
||||
|
||||
pub(crate) fn emit_ref_type(&mut self, node: ast::RefType) -> Label<generated::RefType> {
|
||||
pub(crate) fn emit_ref_type(&mut self, node: ast::RefType) -> Label<generated::RefTypeRepr> {
|
||||
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 {
|
||||
let type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::RefTypeRepr {
|
||||
id: TrapId::Star,
|
||||
is_mut,
|
||||
lifetime,
|
||||
ty,
|
||||
type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(RefType, self, node, label);
|
||||
emit_detached!(RefTypeRepr, self, node, label);
|
||||
self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());
|
||||
label
|
||||
}
|
||||
@@ -1774,14 +1774,14 @@ impl Translator<'_> {
|
||||
label
|
||||
}
|
||||
|
||||
pub(crate) fn emit_ret_type(&mut self, node: ast::RetType) -> Label<generated::RetType> {
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::RetType {
|
||||
pub(crate) fn emit_ret_type(&mut self, node: ast::RetType) -> Label<generated::RetTypeRepr> {
|
||||
let type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::RetTypeRepr {
|
||||
id: TrapId::Star,
|
||||
ty,
|
||||
type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(RetType, self, node, label);
|
||||
emit_detached!(RetTypeRepr, self, node, label);
|
||||
self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());
|
||||
label
|
||||
}
|
||||
@@ -1815,14 +1815,14 @@ impl Translator<'_> {
|
||||
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 type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::SelfParam {
|
||||
id: TrapId::Star,
|
||||
attrs,
|
||||
is_mut,
|
||||
lifetime,
|
||||
name,
|
||||
ty,
|
||||
type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(SelfParam, self, node, label);
|
||||
@@ -1842,14 +1842,14 @@ impl Translator<'_> {
|
||||
label
|
||||
}
|
||||
|
||||
pub(crate) fn emit_slice_type(&mut self, node: ast::SliceType) -> Label<generated::SliceType> {
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::SliceType {
|
||||
pub(crate) fn emit_slice_type(&mut self, node: ast::SliceType) -> Label<generated::SliceTypeRepr> {
|
||||
let type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::SliceTypeRepr {
|
||||
id: TrapId::Star,
|
||||
ty,
|
||||
type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(SliceType, self, node, label);
|
||||
emit_detached!(SliceTypeRepr, self, node, label);
|
||||
self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());
|
||||
label
|
||||
}
|
||||
@@ -1874,7 +1874,7 @@ impl Translator<'_> {
|
||||
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 type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let visibility = node.visibility().map(|x| self.emit_visibility(x));
|
||||
let label = self.trap.emit(generated::Static {
|
||||
id: TrapId::Star,
|
||||
@@ -1883,7 +1883,7 @@ impl Translator<'_> {
|
||||
is_mut,
|
||||
is_static,
|
||||
name,
|
||||
ty,
|
||||
type_repr,
|
||||
visibility,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
@@ -2020,12 +2020,12 @@ impl Translator<'_> {
|
||||
|
||||
pub(crate) fn emit_tuple_field(&mut self, node: ast::TupleField) -> Label<generated::TupleField> {
|
||||
let attrs = node.attrs().map(|x| self.emit_attr(x)).collect();
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let visibility = node.visibility().map(|x| self.emit_visibility(x));
|
||||
let label = self.trap.emit(generated::TupleField {
|
||||
id: TrapId::Star,
|
||||
attrs,
|
||||
ty,
|
||||
type_repr,
|
||||
visibility,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
@@ -2072,14 +2072,14 @@ impl Translator<'_> {
|
||||
label
|
||||
}
|
||||
|
||||
pub(crate) fn emit_tuple_type(&mut self, node: ast::TupleType) -> Label<generated::TupleType> {
|
||||
pub(crate) fn emit_tuple_type(&mut self, node: ast::TupleType) -> Label<generated::TupleTypeRepr> {
|
||||
let fields = node.fields().map(|x| self.emit_type(x)).collect();
|
||||
let label = self.trap.emit(generated::TupleType {
|
||||
let label = self.trap.emit(generated::TupleTypeRepr {
|
||||
id: TrapId::Star,
|
||||
fields,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(TupleType, self, node, label);
|
||||
emit_detached!(TupleTypeRepr, self, node, label);
|
||||
self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());
|
||||
label
|
||||
}
|
||||
@@ -2089,7 +2089,7 @@ impl Translator<'_> {
|
||||
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_repr = node.ty().map(|x| self.emit_type(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));
|
||||
let where_clause = node.where_clause().map(|x| self.emit_where_clause(x));
|
||||
@@ -2099,7 +2099,7 @@ impl Translator<'_> {
|
||||
generic_param_list,
|
||||
is_default,
|
||||
name,
|
||||
ty,
|
||||
type_repr,
|
||||
type_bound_list,
|
||||
visibility,
|
||||
where_clause,
|
||||
@@ -2111,10 +2111,10 @@ impl Translator<'_> {
|
||||
}
|
||||
|
||||
pub(crate) fn emit_type_arg(&mut self, node: ast::TypeArg) -> Label<generated::TypeArg> {
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::TypeArg {
|
||||
id: TrapId::Star,
|
||||
ty,
|
||||
type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(TypeArg, self, node, label);
|
||||
@@ -2127,14 +2127,14 @@ impl Translator<'_> {
|
||||
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 type_repr = 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,
|
||||
type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(TypeBound, self, node, label);
|
||||
@@ -2309,13 +2309,13 @@ impl Translator<'_> {
|
||||
pub(crate) fn emit_where_pred(&mut self, node: ast::WherePred) -> Label<generated::WherePred> {
|
||||
let generic_param_list = node.generic_param_list().map(|x| self.emit_generic_param_list(x));
|
||||
let lifetime = node.lifetime().map(|x| self.emit_lifetime(x));
|
||||
let ty = node.ty().map(|x| self.emit_type(x));
|
||||
let type_repr = node.ty().map(|x| self.emit_type(x));
|
||||
let type_bound_list = node.type_bound_list().map(|x| self.emit_type_bound_list(x));
|
||||
let label = self.trap.emit(generated::WherePred {
|
||||
id: TrapId::Star,
|
||||
generic_param_list,
|
||||
lifetime,
|
||||
ty,
|
||||
type_repr,
|
||||
type_bound_list,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
|
||||
Reference in New Issue
Block a user