Clean up primitive handling, finally.

This commit is contained in:
2024-04-16 16:20:31 -07:00
parent 763a895285
commit 7d4f182a67
19 changed files with 399 additions and 550 deletions

View File

@@ -285,35 +285,39 @@ fn order_of_operations() {
assert_eq!(
Program::from_str(muladd1).unwrap(),
Program {
items: vec![TopLevel::Statement(Statement::Expression(
Expression::Binding(
Location::new(testfile, 0..1),
Name::manufactured("x"),
items: vec![TopLevel::Expression(Expression::Binding(
Location::new(testfile, 0..1),
Name::manufactured("x"),
Box::new(Expression::Call(
Location::new(testfile, 6..7),
Box::new(Expression::Primitive(
Location::new(testfile, 6..7),
"+".to_string(),
vec![
Expression::Value(
Location::new(testfile, 4..5),
Value::Number(None, None, 1),
),
Expression::Primitive(
Name::manufactured("+")
)),
vec![
Expression::Value(
Location::new(testfile, 4..5),
Value::Number(None, None, 1),
),
Expression::Call(
Location::new(testfile, 10..11),
Box::new(Expression::Primitive(
Location::new(testfile, 10..11),
"*".to_string(),
vec![
Expression::Value(
Location::new(testfile, 8..9),
Value::Number(None, None, 2),
),
Expression::Value(
Location::new(testfile, 12..13),
Value::Number(None, None, 3),
),
]
)
]
))
)
Name::manufactured("*")
)),
vec![
Expression::Value(
Location::new(testfile, 8..9),
Value::Number(None, None, 2),
),
Expression::Value(
Location::new(testfile, 12..13),
Value::Number(None, None, 3),
),
]
)
]
))
))],
}
);