From 1a345d469398afdbfa0ab93608279ea802455c46 Mon Sep 17 00:00:00 2001 From: threeoh6000 Date: Wed, 21 Aug 2024 21:56:44 +0100 Subject: [PATCH] Fix variable scoping issues. --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index c1d06e5..d522116 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,6 +46,7 @@ pub fn parse(data: &str) -> Result { let mut argument_builder: String = "".to_string(); let mut statements: Vec = vec![]; let mut labels: HashMap = HashMap::new(); + let mut potential_argument_length; let mut inside_string = false; let mut string_escape = false; @@ -55,7 +56,7 @@ pub fn parse(data: &str) -> Result { program_begun = true; } else if program_begun { if operator.is_none() { - let (operator, potential_argument_length) = operator_to_arglength(char.clone()); + (operator, potential_argument_length) = operator_to_arglength(char.clone()); if potential_argument_length.is_none() { return Err(format!("Invalid operator {} at statement {}.", char, statements.len())); } expected_arguments = potential_argument_length.unwrap(); } else if expected_arguments > 0 {