Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions cmd/gravity/src/codegen/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ enum Direction<'a> {
param_name: &'a GoIdentifier,
},
/// The function is exported from the world.
#[allow(dead_code, reason = "halfway through refactor of func bindings")]
Export,
}

Expand All @@ -46,7 +45,6 @@ pub struct Func<'a> {

impl<'a> Func<'a> {
/// Create a new exported function.
#[allow(dead_code, reason = "halfway through refactor of func bindings")]
pub fn export(result: GoResult, sizes: &'a SizeAlign) -> Self {
Self {
direction: Direction::Export,
Expand Down Expand Up @@ -841,7 +839,7 @@ impl Bindgen for Func<'_> {
let operand = &operands[0];
for field in record.fields.iter() {
let struct_field = GoIdentifier::public(&field.name);
let var = &GoIdentifier::local(format!("{}{tmp}", &field.name));
let var = &GoIdentifier::local(format!("{}{tmp}", field.name));
quote_in! { self.body =>
$['\r']
$var := $operand.$struct_field
Expand Down Expand Up @@ -1232,7 +1230,7 @@ impl Bindgen for Func<'_> {
$['\r']
$(&value) := uint64($operand)
}
results.push(Operand::SingleValue(value.into()));
results.push(Operand::SingleValue(value));
}
Instruction::I64FromS64 => {
// Go's int64 -> uint64 conversion keeps the two's-complement
Expand All @@ -1244,7 +1242,7 @@ impl Bindgen for Func<'_> {
$['\r']
$(&value) := uint64($operand)
}
results.push(Operand::SingleValue(value.into()));
results.push(Operand::SingleValue(value));
}
// Go's integer conversion to uint32 sign-extends the signed types
// and zero-extends the unsigned ones, which is how the canonical
Expand Down Expand Up @@ -1371,7 +1369,7 @@ impl Bindgen for Func<'_> {
$['\r']
$(&value) := uint64($operand)
}
results.push(Operand::SingleValue(value.into()));
results.push(Operand::SingleValue(value));
}
Instruction::CharFromI32 => {
// The canonical ABI rejects surrogates and values above
Expand Down
4 changes: 2 additions & 2 deletions cmd/gravity/src/codegen/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ impl<'a> ImportCodeGenerator<'a> {
TypeDefinition::Enum { cases } => {
let enum_type = &GoIdentifier::private(&typ.name);
let enum_interface = &typ.go_type_name;
let enum_function = &GoIdentifier::private(format!("is-{}", &typ.name));
let enum_function = &GoIdentifier::private(format!("is-{}", typ.name));
let variants = cases.iter().map(GoIdentifier::public);
quote_in! { *tokens =>
$['\n']
Expand Down Expand Up @@ -413,7 +413,7 @@ impl<'a> ImportCodeGenerator<'a> {
}
TypeDefinition::Variant { cases } => {
let variant_interface = &typ.go_type_name;
let marker_method = &GoIdentifier::private(format!("is-{}", &typ.name));
let marker_method = &GoIdentifier::private(format!("is-{}", typ.name));
let case_definitions = cases.iter().map(|case| match &case.dispatch {
CaseDispatch::DirectRecord { record_type } => quote! {
$['\n']
Expand Down
6 changes: 6 additions & 0 deletions examples/records/clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# wit-bindgen's generate! expands, at this crate's root, the core-wasm export
# glue for `modify-foo`: one parameter per flattened value of `foo`, which is
# ten. The canonical ABI passes up to 16 flat values directly, so that is the
# arity the generated glue may legitimately have; the default of 7 would flag
# code this crate does not write.
too-many-arguments-threshold = 16
Loading