mirror of
https://github.com/fluencelabs/interface-types
synced 2024-12-04 23:30:19 +00:00
fix(interface-types) arg.get
's index is of type u32
.
This commit is contained in:
parent
766312fd90
commit
09498ee286
@ -156,7 +156,12 @@ fn instruction<'input, E: ParseError<&'input [u8]>>(
|
||||
Ok(match opcode {
|
||||
0x00 => {
|
||||
consume!((input, argument_0) = uleb(input)?);
|
||||
(input, Instruction::ArgumentGet { index: argument_0 })
|
||||
(
|
||||
input,
|
||||
Instruction::ArgumentGet {
|
||||
index: argument_0 as u32,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
0x01 => {
|
||||
|
@ -252,7 +252,7 @@ where
|
||||
match self {
|
||||
Instruction::ArgumentGet { index } => {
|
||||
0x00_u8.to_bytes(writer)?;
|
||||
index.to_bytes(writer)?;
|
||||
(*index as u64).to_bytes(writer)?;
|
||||
}
|
||||
|
||||
Instruction::Call { function_index } => {
|
||||
|
@ -6,7 +6,7 @@ pub enum Instruction<'input> {
|
||||
/// The `arg.get` instruction.
|
||||
ArgumentGet {
|
||||
/// The argument index.
|
||||
index: u64,
|
||||
index: u32,
|
||||
},
|
||||
|
||||
/// The `call` instruction.
|
||||
|
@ -1,9 +1,9 @@
|
||||
executable_instruction!(
|
||||
argument_get(index: u64, instruction_name: String) -> _ {
|
||||
argument_get(index: u32, instruction_name: String) -> _ {
|
||||
move |runtime| -> _ {
|
||||
let invocation_inputs = runtime.invocation_inputs;
|
||||
|
||||
if index >= (invocation_inputs.len() as u64) {
|
||||
if index >= (invocation_inputs.len() as u32) {
|
||||
return Err(format!(
|
||||
"`{}` cannot access argument #{} because it doesn't exist.",
|
||||
instruction_name, index
|
||||
|
Loading…
Reference in New Issue
Block a user