Change Cart AssignableKind to Index.
This commit is contained in:
parent
31fe3f53be
commit
610ba7fc40
|
@ -47,7 +47,7 @@ pub struct Assignable {
|
||||||
#[derive(Debug, PartialEq, Clone, Hash)]
|
#[derive(Debug, PartialEq, Clone, Hash)]
|
||||||
pub enum AssignableKind {
|
pub enum AssignableKind {
|
||||||
Variable,
|
Variable,
|
||||||
Cart { indices: Vec<Expr> },
|
Index { indices: Vec<Expr> },
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone, Hash)]
|
#[derive(Debug, PartialEq, Clone, Hash)]
|
||||||
|
|
|
@ -248,9 +248,9 @@ impl ExecEnv {
|
||||||
let value = self.eval_expr(value)?;
|
let value = self.eval_expr(value)?;
|
||||||
match assignable.kind {
|
match assignable.kind {
|
||||||
AssignableKind::Variable => {
|
AssignableKind::Variable => {
|
||||||
&self.get_var_mut(&assignable.ident)?.value.replace(value);
|
self.get_var_mut(&assignable.ident)?.value.replace(value);
|
||||||
}
|
}
|
||||||
AssignableKind::Cart { ref indices } => {
|
AssignableKind::Index { ref indices } => {
|
||||||
let mut cell = self.get_var_rc(&assignable.ident)?;
|
let mut cell = self.get_var_rc(&assignable.ident)?;
|
||||||
for index in indices {
|
for index in indices {
|
||||||
let index = self.eval_expr(index)?;
|
let index = self.eval_expr(index)?;
|
||||||
|
|
|
@ -412,7 +412,7 @@ impl<'source> Parser<'source> {
|
||||||
indices.reverse();
|
indices.reverse();
|
||||||
Some(Assignable {
|
Some(Assignable {
|
||||||
ident: Ident::new(ident, buf.span),
|
ident: Ident::new(ident, buf.span),
|
||||||
kind: AssignableKind::Cart { indices },
|
kind: AssignableKind::Index { indices },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue