Fix severe lapse in naming scheme judgement
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
use std::io::{Result, Write};
|
||||
|
||||
use wasm_ast::node::{
|
||||
BinOp, CmpOp, Expression, GetGlobal, GetLocal, LoadAt, MemoryGrow, MemorySize, Recall, Select,
|
||||
UnOp, Value,
|
||||
BinOp, CmpOp, Expression, GetGlobal, GetLocal, GetTemporary, LoadAt, MemoryGrow, MemorySize,
|
||||
Select, UnOp, Value,
|
||||
};
|
||||
|
||||
use crate::analyzer::operator::bin_symbol_of;
|
||||
@@ -11,12 +11,6 @@ use super::manager::{
|
||||
write_cmp_op, write_condition, write_separated, write_variable, Driver, Manager,
|
||||
};
|
||||
|
||||
impl Driver for Recall {
|
||||
fn write(&self, _: &mut Manager, w: &mut dyn Write) -> Result<()> {
|
||||
write!(w, "reg_{} ", self.var)
|
||||
}
|
||||
}
|
||||
|
||||
impl Driver for Select {
|
||||
fn write(&self, mng: &mut Manager, w: &mut dyn Write) -> Result<()> {
|
||||
write!(w, "(")?;
|
||||
@@ -29,6 +23,12 @@ impl Driver for Select {
|
||||
}
|
||||
}
|
||||
|
||||
impl Driver for GetTemporary {
|
||||
fn write(&self, _: &mut Manager, w: &mut dyn Write) -> Result<()> {
|
||||
write!(w, "reg_{} ", self.var)
|
||||
}
|
||||
}
|
||||
|
||||
impl Driver for GetLocal {
|
||||
fn write(&self, mng: &mut Manager, w: &mut dyn Write) -> Result<()> {
|
||||
write_variable(self.var, mng, w)
|
||||
@@ -144,8 +144,8 @@ impl Driver for CmpOp {
|
||||
impl Driver for Expression {
|
||||
fn write(&self, mng: &mut Manager, w: &mut dyn Write) -> Result<()> {
|
||||
match self {
|
||||
Self::Recall(e) => e.write(mng, w),
|
||||
Self::Select(e) => e.write(mng, w),
|
||||
Self::GetTemporary(e) => e.write(mng, w),
|
||||
Self::GetLocal(e) => e.write(mng, w),
|
||||
Self::GetGlobal(e) => e.write(mng, w),
|
||||
Self::LoadAt(e) => e.write(mng, w),
|
||||
|
||||
@@ -5,21 +5,14 @@ use std::{
|
||||
|
||||
use parity_wasm::elements::ValueType;
|
||||
use wasm_ast::node::{
|
||||
Backward, Br, BrIf, BrTable, Call, CallIndirect, Else, Forward, If, Intermediate, Memorize,
|
||||
Return, SetGlobal, SetLocal, Statement, StoreAt,
|
||||
Backward, Br, BrIf, BrTable, Call, CallIndirect, Else, Forward, If, Intermediate, Return,
|
||||
SetGlobal, SetLocal, SetTemporary, Statement, StoreAt,
|
||||
};
|
||||
|
||||
use super::manager::{
|
||||
write_ascending, write_condition, write_separated, write_variable, Driver, Manager,
|
||||
};
|
||||
|
||||
impl Driver for Memorize {
|
||||
fn write(&self, mng: &mut Manager, w: &mut dyn Write) -> Result<()> {
|
||||
write!(w, "reg_{} = ", self.var)?;
|
||||
self.value.write(mng, w)
|
||||
}
|
||||
}
|
||||
|
||||
impl Driver for Forward {
|
||||
fn write(&self, mng: &mut Manager, w: &mut dyn Write) -> Result<()> {
|
||||
let label = mng.push_label();
|
||||
@@ -196,6 +189,13 @@ impl Driver for CallIndirect {
|
||||
}
|
||||
}
|
||||
|
||||
impl Driver for SetTemporary {
|
||||
fn write(&self, mng: &mut Manager, w: &mut dyn Write) -> Result<()> {
|
||||
write!(w, "reg_{} = ", self.var)?;
|
||||
self.value.write(mng, w)
|
||||
}
|
||||
}
|
||||
|
||||
impl Driver for SetLocal {
|
||||
fn write(&self, mng: &mut Manager, w: &mut dyn Write) -> Result<()> {
|
||||
write_variable(self.var, mng, w)?;
|
||||
@@ -230,7 +230,6 @@ impl Driver for Statement {
|
||||
fn write(&self, mng: &mut Manager, w: &mut dyn Write) -> Result<()> {
|
||||
match self {
|
||||
Self::Unreachable => write!(w, "error(\"out of code bounds\")"),
|
||||
Self::Memorize(s) => s.write(mng, w),
|
||||
Self::Forward(s) => s.write(mng, w),
|
||||
Self::Backward(s) => s.write(mng, w),
|
||||
Self::If(s) => s.write(mng, w),
|
||||
@@ -240,6 +239,7 @@ impl Driver for Statement {
|
||||
Self::Return(s) => s.write(mng, w),
|
||||
Self::Call(s) => s.write(mng, w),
|
||||
Self::CallIndirect(s) => s.write(mng, w),
|
||||
Self::SetTemporary(s) => s.write(mng, w),
|
||||
Self::SetLocal(s) => s.write(mng, w),
|
||||
Self::SetGlobal(s) => s.write(mng, w),
|
||||
Self::StoreAt(s) => s.write(mng, w),
|
||||
|
||||
Reference in New Issue
Block a user