Refactor Expected Types During Compilation
By adding an expected type to the compilation context, it is now possible for type checking to occur on keyset expressions and return statements at the moment that they are being compiled. Previously, it was necessary to tentatively compile them and then typecheck afterward. Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
@@ -374,12 +374,12 @@ extension FieldAccessExpression: EvaluatableLValueExpression {
|
||||
}
|
||||
|
||||
extension KeysetExpression: EvaluatableExpression {
|
||||
public func evaluate(execution: Common.ProgramExecution) -> Common.Result<any Common.P4Value> {
|
||||
return self.kse_evaluate(execution: execution)
|
||||
public func evaluate(execution: Common.ProgramExecution) -> Result<P4Value> {
|
||||
return self.key.evaluate(execution: execution)
|
||||
}
|
||||
|
||||
public func type() -> any Common.P4Type {
|
||||
return self.kse_type()
|
||||
public func type() -> P4Type {
|
||||
return self.key.type()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user