1
0

Pass all tests

This commit is contained in:
Jeff 2024-03-17 21:10:51 -04:00
parent 27c25a587b
commit dd5136827c
2 changed files with 7 additions and 7 deletions

View File

@ -24,8 +24,8 @@ impl AbstractTree for Expression {
match self { match self {
Expression::FunctionCall(function_call) => function_call.expected_type(_context), Expression::FunctionCall(function_call) => function_call.expected_type(_context),
Expression::Identifier(identifier) => identifier.expected_type(_context), Expression::Identifier(identifier) => identifier.expected_type(_context),
Expression::MapIndex(index) => index.expected_type(_context), Expression::MapIndex(map_index) => map_index.expected_type(_context),
Expression::ListIndex(_) => todo!(), Expression::ListIndex(list_index) => list_index.expected_type(_context),
Expression::Logic(logic) => logic.expected_type(_context), Expression::Logic(logic) => logic.expected_type(_context),
Expression::Math(math) => math.expected_type(_context), Expression::Math(math) => math.expected_type(_context),
Expression::Value(value_node) => value_node.expected_type(_context), Expression::Value(value_node) => value_node.expected_type(_context),
@ -36,8 +36,8 @@ impl AbstractTree for Expression {
match self { match self {
Expression::FunctionCall(function_call) => function_call.validate(_context), Expression::FunctionCall(function_call) => function_call.validate(_context),
Expression::Identifier(identifier) => identifier.validate(_context), Expression::Identifier(identifier) => identifier.validate(_context),
Expression::MapIndex(index) => index.validate(_context), Expression::MapIndex(map_index) => map_index.validate(_context),
Expression::ListIndex(_) => todo!(), Expression::ListIndex(list_index) => list_index.validate(_context),
Expression::Logic(logic) => logic.validate(_context), Expression::Logic(logic) => logic.validate(_context),
Expression::Math(math) => math.validate(_context), Expression::Math(math) => math.validate(_context),
Expression::Value(value_node) => value_node.validate(_context), Expression::Value(value_node) => value_node.validate(_context),
@ -48,8 +48,8 @@ impl AbstractTree for Expression {
match self { match self {
Expression::FunctionCall(function_call) => function_call.run(_context), Expression::FunctionCall(function_call) => function_call.run(_context),
Expression::Identifier(identifier) => identifier.run(_context), Expression::Identifier(identifier) => identifier.run(_context),
Expression::MapIndex(index) => index.run(_context), Expression::MapIndex(map_index) => map_index.run(_context),
Expression::ListIndex(_) => todo!(), Expression::ListIndex(list_index) => list_index.run(_context),
Expression::Logic(logic) => logic.run(_context), Expression::Logic(logic) => logic.run(_context),
Expression::Math(math) => math.run(_context), Expression::Math(math) => math.run(_context),
Expression::Value(value_node) => value_node.run(_context), Expression::Value(value_node) => value_node.run(_context),

View File

@ -234,7 +234,7 @@ pub fn parser<'src>() -> DustParser<'src> {
just(Token::Control(Control::SquareClose)), just(Token::Control(Control::SquareClose)),
), ),
|op, expression, span| { |op, expression, span| {
Expression::ListIndex(Box::new(ListIndex::new(expression, op))) Expression::ListIndex(Box::new(ListIndex::new(op, expression)))
.with_position(span) .with_position(span)
}, },
), ),