Complete index assignment
This commit is contained in:
parent
a804a85b1f
commit
98ea049229
@ -84,7 +84,7 @@ impl AbstractTree for IndexAssignment {
|
|||||||
AssignmentOperator::Equal => value,
|
AssignmentOperator::Equal => value,
|
||||||
};
|
};
|
||||||
|
|
||||||
context
|
index_context
|
||||||
.variables_mut()?
|
.variables_mut()?
|
||||||
.insert(index_key.clone(), new_value);
|
.insert(index_key.clone(), new_value);
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@ pub enum Statement {
|
|||||||
|
|
||||||
impl AbstractTree for Statement {
|
impl AbstractTree for Statement {
|
||||||
fn from_syntax_node(source: &str, node: Node) -> Result<Self> {
|
fn from_syntax_node(source: &str, node: Node) -> Result<Self> {
|
||||||
|
Error::expect_syntax_node(source, "statement", node)?;
|
||||||
|
|
||||||
let child = node.child(0).unwrap();
|
let child = node.child(0).unwrap();
|
||||||
|
|
||||||
match child.kind() {
|
match child.kind() {
|
||||||
@ -75,11 +77,12 @@ impl AbstractTree for Statement {
|
|||||||
"index_assignment" => Ok(Statement::IndexAssignment(Box::new(IndexAssignment::from_syntax_node(
|
"index_assignment" => Ok(Statement::IndexAssignment(Box::new(IndexAssignment::from_syntax_node(
|
||||||
source, child,
|
source, child,
|
||||||
)?))),
|
)?))),
|
||||||
_ => Err(Error::expect_syntax_node(
|
_ => Err(Error::UnexpectedSyntaxNode {
|
||||||
source,
|
expected: "assignment, expression, if...else, while, for, transform, filter, tool, async, find, remove, select, insert or index_assignment",
|
||||||
"assignment, expression, if...else, while, for, transform, filter, tool, async, find, remove, select, insert or index_assignment",
|
actual: child.kind(),
|
||||||
child
|
location: child.start_position(),
|
||||||
).unwrap_err())
|
relevant_source: source[child.byte_range()].to_string(),
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user