Rust: rerun code generation

This commit is contained in:
Paolo Tranquilli
2025-02-25 13:29:17 +01:00
parent 17703ec908
commit cbae16b392
13 changed files with 62 additions and 12 deletions

View File

@@ -1,2 +1,2 @@
mod.rs 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7
top.rs 18702be33d768cc6f723201fce8c2bf2125df192c0336db9711a99f8fa7b074f 18702be33d768cc6f723201fce8c2bf2125df192c0336db9711a99f8fa7b074f
top.rs da0f43b99d3a173520048275597e2b052a7351f6fcb2ad5fc912257976742bb7 da0f43b99d3a173520048275597e2b052a7351f6fcb2ad5fc912257976742bb7

View File

@@ -2185,6 +2185,7 @@ impl From<trap::Label<RecordExprFieldList>> for trap::Label<Locatable> {
pub struct RecordField {
pub id: trap::TrapId<RecordField>,
pub attrs: Vec<trap::Label<Attr>>,
pub expr: Option<trap::Label<Expr>>,
pub name: Option<trap::Label<Name>>,
pub type_repr: Option<trap::Label<TypeRepr>>,
pub visibility: Option<trap::Label<Visibility>>,
@@ -2200,6 +2201,9 @@ impl trap::TrapEntry for RecordField {
for (i, v) in self.attrs.into_iter().enumerate() {
out.add_tuple("record_field_attrs", vec![id.into(), i.into(), v.into()]);
}
if let Some(v) = self.expr {
out.add_tuple("record_field_exprs", vec![id.into(), v.into()]);
}
if let Some(v) = self.name {
out.add_tuple("record_field_names", vec![id.into(), v.into()]);
}

View File

@@ -1849,12 +1849,14 @@ impl Translator<'_> {
pub(crate) fn emit_record_field(&mut self, node: ast::RecordField) -> Option<Label<generated::RecordField>> {
if self.should_be_excluded(&node) { return None; }
let attrs = node.attrs().filter_map(|x| self.emit_attr(x)).collect();
let expr = node.expr().and_then(|x| self.emit_expr(x));
let name = node.name().and_then(|x| self.emit_name(x));
let type_repr = node.ty().and_then(|x| self.emit_type(x));
let visibility = node.visibility().and_then(|x| self.emit_visibility(x));
let label = self.trap.emit(generated::RecordField {
id: TrapId::Star,
attrs,
expr,
name,
type_repr,
visibility,