This commit is contained in:
Jeff 2024-09-05 11:36:55 -04:00
parent 72a019cfe5
commit 5c9a8dab31
2 changed files with 7 additions and 7 deletions

View File

@ -159,12 +159,12 @@ impl Context {
/// program. Returns a boolean indicating whether the identifier was found. If the identifier is /// program. Returns a boolean indicating whether the identifier was found. If the identifier is
/// not found in the current context, the parent context is searched but parent context's /// not found in the current context, the parent context is searched but parent context's
/// position is not updated. /// position is not updated.
pub fn update_last_position( pub fn set_position(
&self, &self,
identifier: &Identifier, identifier: &Identifier,
position: usize, position: usize,
) -> Result<bool, ContextError> { ) -> Result<bool, ContextError> {
self.inner.update_last_position(identifier, position) self.inner.set_position(identifier, position)
} }
/// Recovers the context from a poisoned state by recovering data from an error. /// Recovers the context from a poisoned state by recovering data from an error.
@ -457,7 +457,7 @@ impl ContextInner {
/// program. Returns a boolean indicating whether the identifier was found. If the identifier is /// program. Returns a boolean indicating whether the identifier was found. If the identifier is
/// not found in the current context, the parent context is searched but parent context's /// not found in the current context, the parent context is searched but parent context's
/// position is not updated. /// position is not updated.
pub fn update_last_position( pub fn set_position(
&self, &self,
identifier: &Identifier, identifier: &Identifier,
position: usize, position: usize,

View File

@ -453,7 +453,7 @@ impl<'src> Parser<'src> {
let identifier = Identifier::new(text); let identifier = Identifier::new(text);
if let ParserMode::Condition = self.mode { if let ParserMode::Condition = self.mode {
context.update_last_position(&identifier, start_position.1)?; context.set_position(&identifier, start_position.1)?;
return Ok(Expression::identifier(identifier, start_position)); return Ok(Expression::identifier(identifier, start_position));
} }
@ -494,7 +494,7 @@ impl<'src> Parser<'src> {
let position = (start_position.0, self.current_position.1); let position = (start_position.0, self.current_position.1);
context.update_last_position(&identifier, position.1)?; context.set_position(&identifier, position.1)?;
return Ok(Expression::r#struct( return Ok(Expression::r#struct(
StructExpression::Fields { name, fields }, StructExpression::Fields { name, fields },
@ -502,7 +502,7 @@ impl<'src> Parser<'src> {
)); ));
} }
context.update_last_position(&identifier, start_position.1)?; context.set_position(&identifier, start_position.1)?;
Ok(Expression::identifier(identifier, start_position)) Ok(Expression::identifier(identifier, start_position))
} }
@ -986,7 +986,7 @@ impl<'src> Parser<'src> {
self.next_token()?; self.next_token()?;
context.update_last_position(&identifier, position.1)?; context.set_position(&identifier, position.1)?;
Ok(Node::new(identifier, position)) Ok(Node::new(identifier, position))
} else { } else {