Work On Derived Types

1. Add support for field access
2. Add support for proper type checking of array access
3. Add tests for nested field and array access

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-03-16 08:31:16 -04:00
parent 8ee20fcf9f
commit 2fd5ecf8d6
10 changed files with 629 additions and 72 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ extension ConditionalStatement: EvaluatableStatement {
guard case .Ok(let evaluated_condition) = self.condition.evaluate(execution: execution) else {
return execution.setError(error: Error(withMessage: "Could not evaluate \(self.condition)"))
}
if !evaluated_condition.type().eq(rhs: P4Boolean.create()) {
if !evaluated_condition.type().eq(rhs: P4Boolean()) {
return execution.setError(error: Error(withMessage: "Condition expression is not a Boolean"))
}
if evaluated_condition.eq(rhs: P4BooleanValue.init(withValue: true)) {