1
0
This commit is contained in:
Jeff 2023-10-23 17:36:11 -04:00
parent 8348b6ce85
commit 72af839102
4 changed files with 4 additions and 11 deletions

View File

@ -10,6 +10,7 @@ data = {
for creature in sea_creatures {
data.creatures += creature.name
data.total_clams += creature.clams
if creature.type == 'dolphin' {
data.dolphin_clams += creature.clams
}

View File

@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
use tree_sitter::Node;
use crate::{value, AbstractTree, Error, Result, Value, VariableMap};
use crate::{AbstractTree, Error, Result, Value, VariableMap};
use super::{identifier::Identifier, statement::Statement};

View File

@ -85,8 +85,6 @@ impl<'context, 'code> Evaluator<'context, 'code> {
let root_node = cursor.node();
let mut prev_result = Ok(Value::Empty);
println!("{}", root_node.to_sexp());
for item_node in root_node.children(&mut cursor) {
let item = Item::from_syntax_node(self.source, item_node)?;
prev_result = item.run(self.source, self.context);

View File

@ -780,10 +780,7 @@ impl<'de> Visitor<'de> for ValueVisitor {
where
E: serde::de::Error,
{
Err(serde::de::Error::invalid_type(
serde::de::Unexpected::Option,
&self,
))
Ok(Value::Empty)
}
fn visit_some<D>(self, deserializer: D) -> std::result::Result<Self::Value, D::Error>
@ -801,10 +798,7 @@ impl<'de> Visitor<'de> for ValueVisitor {
where
E: serde::de::Error,
{
Err(serde::de::Error::invalid_type(
serde::de::Unexpected::Unit,
&self,
))
Ok(Value::Empty)
}
fn visit_newtype_struct<D>(self, deserializer: D) -> std::result::Result<Self::Value, D::Error>