Housekeeping with clippy
This commit is contained in:
parent
857737ff52
commit
7a49d61e0a
@ -105,17 +105,16 @@ impl DriverNoContext for BinOp {
|
||||
write!(w, "(")?;
|
||||
self.lhs().write(w)?;
|
||||
write!(w, " {symbol} ")?;
|
||||
self.rhs().write(w)?;
|
||||
write!(w, ")")
|
||||
} else {
|
||||
let (head, tail) = self.op_type().as_name();
|
||||
|
||||
write!(w, "{head}_{tail}(")?;
|
||||
self.lhs().write(w)?;
|
||||
write!(w, ", ")?;
|
||||
self.rhs().write(w)?;
|
||||
write!(w, ")")
|
||||
}
|
||||
|
||||
self.rhs().write(w)?;
|
||||
write!(w, ")")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ impl Manager {
|
||||
self.label_list.pop().unwrap();
|
||||
}
|
||||
|
||||
pub fn indentation(&self) -> usize {
|
||||
pub const fn indentation(&self) -> usize {
|
||||
self.indentation
|
||||
}
|
||||
|
||||
|
@ -25,11 +25,11 @@ trait AsIEName {
|
||||
impl AsIEName for External {
|
||||
fn as_ie_name(&self) -> &str {
|
||||
match self {
|
||||
External::Func => "func_list",
|
||||
External::Table => "table_list",
|
||||
External::Memory => "memory_list",
|
||||
External::Global => "global_list",
|
||||
External::Tag => unimplemented!(),
|
||||
Self::Func => "func_list",
|
||||
Self::Table => "table_list",
|
||||
Self::Memory => "memory_list",
|
||||
Self::Global => "global_list",
|
||||
Self::Tag => unimplemented!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -41,10 +41,7 @@ fn reader_to_code(reader: OperatorsReader) -> Vec<Operator> {
|
||||
}
|
||||
|
||||
fn write_named_array(name: &str, len: usize, w: &mut dyn Write) -> Result<()> {
|
||||
let len = match len.checked_sub(1) {
|
||||
Some(len) => len,
|
||||
None => return Ok(()),
|
||||
};
|
||||
let Some(len) = len.checked_sub(1) else { return Ok(()) };
|
||||
|
||||
writeln!(w, "local {name} = table_new({len}, 1)")
|
||||
}
|
||||
@ -154,13 +151,7 @@ fn write_global_list(wasm: &Module, type_info: &TypeInfo, w: &mut dyn Write) ->
|
||||
|
||||
fn write_element_list(list: &[Element], type_info: &TypeInfo, w: &mut dyn Write) -> Result<()> {
|
||||
for element in list {
|
||||
let (index, init) = match element.kind {
|
||||
ElementKind::Active {
|
||||
table_index,
|
||||
offset_expr,
|
||||
} => (table_index, offset_expr),
|
||||
_ => unimplemented!(),
|
||||
};
|
||||
let ElementKind::Active { table_index: index, offset_expr: init } = element.kind else { unreachable!() };
|
||||
|
||||
writeln!(w, "\tdo")?;
|
||||
writeln!(w, "\t\tlocal target = TABLE_LIST[{index}].data")?;
|
||||
@ -264,10 +255,9 @@ fn write_localize_used(func_list: &[FuncData], w: &mut dyn Write) -> Result<BTre
|
||||
fn write_func_start(wasm: &Module, index: u32, w: &mut dyn Write) -> Result<()> {
|
||||
write!(w, "FUNC_LIST[{index}] = ")?;
|
||||
|
||||
match wasm.name_section().get(&index) {
|
||||
Some(name) => write!(w, "--[[ {name} ]] "),
|
||||
None => Ok(()),
|
||||
}
|
||||
wasm.name_section()
|
||||
.get(&index)
|
||||
.map_or_else(|| Ok(()), |name| write!(w, "--[[ {name} ]] "))
|
||||
}
|
||||
|
||||
fn write_func_list(wasm: &Module, func_list: &[FuncData], w: &mut dyn Write) -> Result<()> {
|
||||
|
@ -125,17 +125,16 @@ impl DriverNoContext for BinOp {
|
||||
write!(w, "(")?;
|
||||
self.lhs().write(w)?;
|
||||
write!(w, " {symbol} ")?;
|
||||
self.rhs().write(w)?;
|
||||
write!(w, ")")
|
||||
} else {
|
||||
let (head, tail) = self.op_type().as_name();
|
||||
|
||||
write!(w, "{head}_{tail}(")?;
|
||||
self.lhs().write(w)?;
|
||||
write!(w, ", ")?;
|
||||
self.rhs().write(w)?;
|
||||
write!(w, ")")
|
||||
}
|
||||
|
||||
self.rhs().write(w)?;
|
||||
write!(w, ")")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ impl Manager {
|
||||
self.label_list.pop().unwrap();
|
||||
}
|
||||
|
||||
pub fn indentation(&self) -> usize {
|
||||
pub const fn indentation(&self) -> usize {
|
||||
self.indentation
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ impl Driver for Br {
|
||||
}
|
||||
|
||||
if self.target() == 0 {
|
||||
if let Some(Some(LabelType::Backward)) = mng.label_list().last() {
|
||||
if mng.label_list().last() == Some(&Some(LabelType::Backward)) {
|
||||
line!(mng, w, "continue")
|
||||
} else {
|
||||
line!(mng, w, "break")
|
||||
|
@ -25,11 +25,11 @@ trait AsIEName {
|
||||
impl AsIEName for External {
|
||||
fn as_ie_name(&self) -> &str {
|
||||
match self {
|
||||
External::Func => "func_list",
|
||||
External::Table => "table_list",
|
||||
External::Memory => "memory_list",
|
||||
External::Global => "global_list",
|
||||
External::Tag => unimplemented!(),
|
||||
Self::Func => "func_list",
|
||||
Self::Table => "table_list",
|
||||
Self::Memory => "memory_list",
|
||||
Self::Global => "global_list",
|
||||
Self::Tag => unimplemented!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -41,10 +41,7 @@ fn reader_to_code(reader: OperatorsReader) -> Vec<Operator> {
|
||||
}
|
||||
|
||||
fn write_named_array(name: &str, len: usize, w: &mut dyn Write) -> Result<()> {
|
||||
let len = match len.checked_sub(1) {
|
||||
Some(len) => len,
|
||||
None => return Ok(()),
|
||||
};
|
||||
let Some(len) = len.checked_sub(1) else { return Ok(()) };
|
||||
|
||||
writeln!(w, "local {name} = table.create({len})")
|
||||
}
|
||||
@ -154,13 +151,7 @@ fn write_global_list(wasm: &Module, type_info: &TypeInfo, w: &mut dyn Write) ->
|
||||
|
||||
fn write_element_list(list: &[Element], type_info: &TypeInfo, w: &mut dyn Write) -> Result<()> {
|
||||
for element in list {
|
||||
let (index, init) = match element.kind {
|
||||
ElementKind::Active {
|
||||
table_index,
|
||||
offset_expr,
|
||||
} => (table_index, offset_expr),
|
||||
_ => unimplemented!(),
|
||||
};
|
||||
let ElementKind::Active { table_index: index, offset_expr: init } = element.kind else { unreachable!() };
|
||||
|
||||
writeln!(w, "\tdo")?;
|
||||
writeln!(w, "\t\tlocal target = TABLE_LIST[{index}].data")?;
|
||||
@ -277,10 +268,9 @@ fn write_localize_used(
|
||||
fn write_func_start(wasm: &Module, index: u32, w: &mut dyn Write) -> Result<()> {
|
||||
write!(w, "FUNC_LIST[{index}] = ")?;
|
||||
|
||||
match wasm.name_section().get(&index) {
|
||||
Some(name) => write!(w, "--[[ {name} ]] "),
|
||||
None => Ok(()),
|
||||
}
|
||||
wasm.name_section()
|
||||
.get(&index)
|
||||
.map_or_else(|| Ok(()), |name| write!(w, "--[[ {name} ]] "))
|
||||
}
|
||||
|
||||
fn write_func_list(wasm: &Module, func_list: &[FuncData], w: &mut dyn Write) -> Result<()> {
|
||||
|
@ -25,8 +25,8 @@ impl Luau {
|
||||
}
|
||||
|
||||
fn write_i64(data: i64, w: &mut dyn Write) -> Result<()> {
|
||||
let data_1 = (data & 0xFFFFFFFF) as u32;
|
||||
let data_2 = (data >> 32 & 0xFFFFFFFF) as u32;
|
||||
let data_1 = (data & 0xFFFF_FFFF) as u32;
|
||||
let data_2 = (data >> 32 & 0xFFFF_FFFF) as u32;
|
||||
|
||||
write!(w, "rt.i64.from_u32({data_1}, {data_2})")
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ use wast::{
|
||||
|
||||
macro_rules! impl_write_number_nan {
|
||||
($name:ident, $name_nan:ident, $numeric:ty, $pattern:ty) => {
|
||||
#[allow(clippy::missing_errors_doc)]
|
||||
pub fn $name(number: $numeric, w: &mut dyn Write) -> Result<()> {
|
||||
match (number.classify(), number.is_sign_negative()) {
|
||||
(FpCategory::Nan, true) => write!(w, "-LUA_NAN_DEFAULT "),
|
||||
@ -23,6 +24,7 @@ macro_rules! impl_write_number_nan {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::missing_errors_doc)]
|
||||
pub fn $name_nan(data: &wast::core::NanPattern<$pattern>, w: &mut dyn Write) -> Result<()> {
|
||||
use wast::core::NanPattern;
|
||||
|
||||
@ -42,6 +44,7 @@ macro_rules! impl_write_number_nan {
|
||||
impl_write_number_nan!(write_f32, write_f32_nan, f32, wast::token::Float32);
|
||||
impl_write_number_nan!(write_f64, write_f64_nan, f64, wast::token::Float64);
|
||||
|
||||
#[allow(clippy::missing_const_for_fn)]
|
||||
fn try_into_ast_module(data: QuoteWat) -> Option<WaModule> {
|
||||
if let QuoteWat::Wat(Wat::Module(data)) = data {
|
||||
Some(data)
|
||||
@ -54,6 +57,7 @@ pub fn get_name_from_id(id: Option<Id>) -> &str {
|
||||
id.as_ref().map_or("temp", Id::name)
|
||||
}
|
||||
|
||||
#[allow(clippy::missing_errors_doc)]
|
||||
pub trait Target: Sized {
|
||||
fn executable() -> String;
|
||||
|
||||
@ -144,7 +148,7 @@ pub trait Target: Sized {
|
||||
.join(name)
|
||||
.with_extension("wast.lua");
|
||||
|
||||
std::fs::write(&temp, &data)?;
|
||||
std::fs::write(&temp, data)?;
|
||||
Self::run_command(&temp)
|
||||
}
|
||||
}
|
||||
|
@ -293,10 +293,7 @@ impl<'a> Factory<'a> {
|
||||
}
|
||||
|
||||
fn start_else(&mut self) {
|
||||
let ty = match self.target.block_data {
|
||||
BlockData::If { ty, .. } => ty,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let BlockData::If { ty, .. } = self.target.block_data else { unreachable!() };
|
||||
|
||||
self.target.leak_all();
|
||||
self.end_block();
|
||||
@ -626,7 +623,7 @@ impl<'a> Factory<'a> {
|
||||
let n = self.target.stack.pop().into();
|
||||
let value = self.target.stack.pop().into();
|
||||
|
||||
let data = Statement::MemoryFill(MemoryFill { mem, n, value });
|
||||
let data = Statement::MemoryFill(MemoryFill { mem, value, n });
|
||||
|
||||
self.target.code.push(data);
|
||||
}
|
||||
@ -634,7 +631,7 @@ impl<'a> Factory<'a> {
|
||||
Operator::I64Const { value } => self.target.push_constant(value),
|
||||
Operator::F32Const { value } => self.target.push_constant(value.bits()),
|
||||
Operator::F64Const { value } => self.target.push_constant(value.bits()),
|
||||
_ => panic!("Unsupported instruction: {:?}", op),
|
||||
_ => panic!("Unsupported instruction: {op:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,11 @@ pub enum External {
|
||||
impl From<TypeRef> for External {
|
||||
fn from(value: TypeRef) -> Self {
|
||||
match value {
|
||||
TypeRef::Func(_) => External::Func,
|
||||
TypeRef::Table(_) => External::Table,
|
||||
TypeRef::Memory(_) => External::Memory,
|
||||
TypeRef::Global(_) => External::Global,
|
||||
TypeRef::Tag(_) => External::Tag,
|
||||
TypeRef::Func(_) => Self::Func,
|
||||
TypeRef::Table(_) => Self::Table,
|
||||
TypeRef::Memory(_) => Self::Memory,
|
||||
TypeRef::Global(_) => Self::Global,
|
||||
TypeRef::Tag(_) => Self::Tag,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -29,11 +29,11 @@ impl From<TypeRef> for External {
|
||||
impl From<ExternalKind> for External {
|
||||
fn from(value: ExternalKind) -> Self {
|
||||
match value {
|
||||
ExternalKind::Func => External::Func,
|
||||
ExternalKind::Table => External::Table,
|
||||
ExternalKind::Memory => External::Memory,
|
||||
ExternalKind::Global => External::Global,
|
||||
ExternalKind::Tag => External::Tag,
|
||||
ExternalKind::Func => Self::Func,
|
||||
ExternalKind::Table => Self::Table,
|
||||
ExternalKind::Memory => Self::Memory,
|
||||
ExternalKind::Global => Self::Global,
|
||||
ExternalKind::Tag => Self::Tag,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -199,12 +199,12 @@ impl<'a> Module<'a> {
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn name_section(&self) -> &HashMap<u32, &'a str> {
|
||||
pub const fn name_section(&self) -> &HashMap<u32, &'a str> {
|
||||
&self.name_section
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn start_section(&self) -> Option<u32> {
|
||||
pub const fn start_section(&self) -> Option<u32> {
|
||||
self.start_section
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ pub enum LoadType {
|
||||
|
||||
impl LoadType {
|
||||
#[must_use]
|
||||
pub fn as_name(self) -> &'static str {
|
||||
pub const fn as_name(self) -> &'static str {
|
||||
match self {
|
||||
Self::I32 => "i32",
|
||||
Self::I64 => "i64",
|
||||
@ -85,7 +85,7 @@ pub enum StoreType {
|
||||
|
||||
impl StoreType {
|
||||
#[must_use]
|
||||
pub fn as_name(self) -> &'static str {
|
||||
pub const fn as_name(self) -> &'static str {
|
||||
match self {
|
||||
Self::I32 => "i32",
|
||||
Self::I64 => "i64",
|
||||
@ -188,7 +188,7 @@ pub enum UnOpType {
|
||||
|
||||
impl UnOpType {
|
||||
#[must_use]
|
||||
pub fn as_name(self) -> (&'static str, &'static str) {
|
||||
pub const fn as_name(self) -> (&'static str, &'static str) {
|
||||
match self {
|
||||
Self::Clz_I32 => ("clz", "i32"),
|
||||
Self::Ctz_I32 => ("ctz", "i32"),
|
||||
@ -373,7 +373,7 @@ pub enum BinOpType {
|
||||
|
||||
impl BinOpType {
|
||||
#[must_use]
|
||||
pub fn as_name(self) -> (&'static str, &'static str) {
|
||||
pub const fn as_name(self) -> (&'static str, &'static str) {
|
||||
match self {
|
||||
Self::Add_I32 => ("add", "i32"),
|
||||
Self::Sub_I32 => ("sub", "i32"),
|
||||
@ -520,7 +520,7 @@ pub enum CmpOpType {
|
||||
|
||||
impl CmpOpType {
|
||||
#[must_use]
|
||||
pub fn as_name(self) -> (&'static str, &'static str) {
|
||||
pub const fn as_name(self) -> (&'static str, &'static str) {
|
||||
match self {
|
||||
Self::Eq_I32 => ("eq", "i32"),
|
||||
Self::Ne_I32 => ("ne", "i32"),
|
||||
@ -633,7 +633,7 @@ pub struct GetTemporary {
|
||||
|
||||
impl GetTemporary {
|
||||
#[must_use]
|
||||
pub fn var(&self) -> usize {
|
||||
pub const fn var(&self) -> usize {
|
||||
self.var
|
||||
}
|
||||
}
|
||||
@ -644,7 +644,7 @@ pub struct GetLocal {
|
||||
|
||||
impl GetLocal {
|
||||
#[must_use]
|
||||
pub fn var(&self) -> usize {
|
||||
pub const fn var(&self) -> usize {
|
||||
self.var
|
||||
}
|
||||
}
|
||||
@ -655,7 +655,7 @@ pub struct GetGlobal {
|
||||
|
||||
impl GetGlobal {
|
||||
#[must_use]
|
||||
pub fn var(&self) -> usize {
|
||||
pub const fn var(&self) -> usize {
|
||||
self.var
|
||||
}
|
||||
}
|
||||
@ -669,22 +669,22 @@ pub struct LoadAt {
|
||||
|
||||
impl LoadAt {
|
||||
#[must_use]
|
||||
pub fn load_type(&self) -> LoadType {
|
||||
pub const fn load_type(&self) -> LoadType {
|
||||
self.load_type
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn memory(&self) -> usize {
|
||||
pub const fn memory(&self) -> usize {
|
||||
self.memory
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn offset(&self) -> u32 {
|
||||
pub const fn offset(&self) -> u32 {
|
||||
self.offset
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn pointer(&self) -> &Expression {
|
||||
pub const fn pointer(&self) -> &Expression {
|
||||
&self.pointer
|
||||
}
|
||||
}
|
||||
@ -695,7 +695,7 @@ pub struct MemorySize {
|
||||
|
||||
impl MemorySize {
|
||||
#[must_use]
|
||||
pub fn memory(&self) -> usize {
|
||||
pub const fn memory(&self) -> usize {
|
||||
self.memory
|
||||
}
|
||||
}
|
||||
@ -739,7 +739,7 @@ pub struct UnOp {
|
||||
|
||||
impl UnOp {
|
||||
#[must_use]
|
||||
pub fn op_type(&self) -> UnOpType {
|
||||
pub const fn op_type(&self) -> UnOpType {
|
||||
self.op_type
|
||||
}
|
||||
|
||||
@ -757,7 +757,7 @@ pub struct BinOp {
|
||||
|
||||
impl BinOp {
|
||||
#[must_use]
|
||||
pub fn op_type(&self) -> BinOpType {
|
||||
pub const fn op_type(&self) -> BinOpType {
|
||||
self.op_type
|
||||
}
|
||||
|
||||
@ -780,7 +780,7 @@ pub struct CmpOp {
|
||||
|
||||
impl CmpOp {
|
||||
#[must_use]
|
||||
pub fn op_type(&self) -> CmpOpType {
|
||||
pub const fn op_type(&self) -> CmpOpType {
|
||||
self.op_type
|
||||
}
|
||||
|
||||
@ -816,17 +816,17 @@ pub struct Align {
|
||||
|
||||
impl Align {
|
||||
#[must_use]
|
||||
pub fn is_aligned(&self) -> bool {
|
||||
pub const fn is_aligned(&self) -> bool {
|
||||
self.length == 0 || self.new == self.old
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn new_range(&self) -> Range<usize> {
|
||||
pub const fn new_range(&self) -> Range<usize> {
|
||||
self.new..self.new + self.length
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn old_range(&self) -> Range<usize> {
|
||||
pub const fn old_range(&self) -> Range<usize> {
|
||||
self.old..self.old + self.length
|
||||
}
|
||||
}
|
||||
@ -838,12 +838,12 @@ pub struct Br {
|
||||
|
||||
impl Br {
|
||||
#[must_use]
|
||||
pub fn target(&self) -> usize {
|
||||
pub const fn target(&self) -> usize {
|
||||
self.target
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn align(&self) -> &Align {
|
||||
pub const fn align(&self) -> &Align {
|
||||
&self.align
|
||||
}
|
||||
}
|
||||
@ -866,7 +866,7 @@ impl BrTable {
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn default(&self) -> &Br {
|
||||
pub const fn default(&self) -> &Br {
|
||||
&self.default
|
||||
}
|
||||
}
|
||||
@ -892,7 +892,7 @@ pub struct Block {
|
||||
|
||||
impl Block {
|
||||
#[must_use]
|
||||
pub fn label_type(&self) -> Option<LabelType> {
|
||||
pub const fn label_type(&self) -> Option<LabelType> {
|
||||
self.label_type
|
||||
}
|
||||
|
||||
@ -902,7 +902,7 @@ impl Block {
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn last(&self) -> Option<&Terminator> {
|
||||
pub const fn last(&self) -> Option<&Terminator> {
|
||||
self.last.as_ref()
|
||||
}
|
||||
}
|
||||
@ -919,7 +919,7 @@ impl BrIf {
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn target(&self) -> &Br {
|
||||
pub const fn target(&self) -> &Br {
|
||||
&self.target
|
||||
}
|
||||
}
|
||||
@ -937,12 +937,12 @@ impl If {
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn on_true(&self) -> &Block {
|
||||
pub const fn on_true(&self) -> &Block {
|
||||
&self.on_true
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn on_false(&self) -> Option<&Block> {
|
||||
pub const fn on_false(&self) -> Option<&Block> {
|
||||
self.on_false.as_ref()
|
||||
}
|
||||
}
|
||||
@ -955,7 +955,7 @@ pub struct Call {
|
||||
|
||||
impl Call {
|
||||
#[must_use]
|
||||
pub fn function(&self) -> usize {
|
||||
pub const fn function(&self) -> usize {
|
||||
self.function
|
||||
}
|
||||
|
||||
@ -979,7 +979,7 @@ pub struct CallIndirect {
|
||||
|
||||
impl CallIndirect {
|
||||
#[must_use]
|
||||
pub fn table(&self) -> usize {
|
||||
pub const fn table(&self) -> usize {
|
||||
self.table
|
||||
}
|
||||
|
||||
@ -1006,7 +1006,7 @@ pub struct SetTemporary {
|
||||
|
||||
impl SetTemporary {
|
||||
#[must_use]
|
||||
pub fn var(&self) -> usize {
|
||||
pub const fn var(&self) -> usize {
|
||||
self.var
|
||||
}
|
||||
|
||||
@ -1023,7 +1023,7 @@ pub struct SetLocal {
|
||||
|
||||
impl SetLocal {
|
||||
#[must_use]
|
||||
pub fn var(&self) -> usize {
|
||||
pub const fn var(&self) -> usize {
|
||||
self.var
|
||||
}
|
||||
|
||||
@ -1040,7 +1040,7 @@ pub struct SetGlobal {
|
||||
|
||||
impl SetGlobal {
|
||||
#[must_use]
|
||||
pub fn var(&self) -> usize {
|
||||
pub const fn var(&self) -> usize {
|
||||
self.var
|
||||
}
|
||||
|
||||
@ -1060,17 +1060,17 @@ pub struct StoreAt {
|
||||
|
||||
impl StoreAt {
|
||||
#[must_use]
|
||||
pub fn store_type(&self) -> StoreType {
|
||||
pub const fn store_type(&self) -> StoreType {
|
||||
self.store_type
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn memory(&self) -> usize {
|
||||
pub const fn memory(&self) -> usize {
|
||||
self.memory
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn offset(&self) -> u32 {
|
||||
pub const fn offset(&self) -> u32 {
|
||||
self.offset
|
||||
}
|
||||
|
||||
@ -1093,12 +1093,12 @@ pub struct MemoryGrow {
|
||||
|
||||
impl MemoryGrow {
|
||||
#[must_use]
|
||||
pub fn memory(&self) -> usize {
|
||||
pub const fn memory(&self) -> usize {
|
||||
self.memory
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn result(&self) -> usize {
|
||||
pub const fn result(&self) -> usize {
|
||||
self.result
|
||||
}
|
||||
|
||||
@ -1116,11 +1116,11 @@ pub struct MemoryCopy {
|
||||
|
||||
impl MemoryCopy {
|
||||
#[must_use]
|
||||
pub fn dst(&self) -> u32 {
|
||||
pub const fn dst(&self) -> u32 {
|
||||
self.dst
|
||||
}
|
||||
#[must_use]
|
||||
pub fn src(&self) -> u32 {
|
||||
pub const fn src(&self) -> u32 {
|
||||
self.src
|
||||
}
|
||||
#[must_use]
|
||||
@ -1137,7 +1137,7 @@ pub struct MemoryFill {
|
||||
|
||||
impl MemoryFill {
|
||||
#[must_use]
|
||||
pub fn mem(&self) -> u32 {
|
||||
pub const fn mem(&self) -> u32 {
|
||||
self.mem
|
||||
}
|
||||
#[must_use]
|
||||
@ -1180,22 +1180,22 @@ impl FuncData {
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn num_result(&self) -> usize {
|
||||
pub const fn num_result(&self) -> usize {
|
||||
self.num_result
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn num_param(&self) -> usize {
|
||||
pub const fn num_param(&self) -> usize {
|
||||
self.num_param
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn num_stack(&self) -> usize {
|
||||
pub const fn num_stack(&self) -> usize {
|
||||
self.num_stack
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn code(&self) -> &Block {
|
||||
pub const fn code(&self) -> &Block {
|
||||
&self.code
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ pub struct Slot {
|
||||
}
|
||||
|
||||
impl Slot {
|
||||
fn is_temporary(&self, id: usize) -> bool {
|
||||
const fn is_temporary(&self, id: usize) -> bool {
|
||||
matches!(self.data, Expression::GetTemporary(ref v) if v.var() == id)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user