compiler, runtime: Refactor P4DataType to P4Type

Now that the old P4Type is a P4QualifiedType, it makes sense to
rename the data type back to just type.

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-05-04 07:37:48 -04:00
parent 7c660b2b0c
commit 5cfe5532a2
15 changed files with 77 additions and 77 deletions
+4 -4
View File
@@ -542,7 +542,7 @@ extension Action: Compilable {
public static func Compile(
node: SwiftTreeSitter.Node, withContext context: CompilerContext
) -> Common.Result<(P4Lang.Action, CompilerContext)> {
#RequireNodeType<Node, (P4DataType, CompilerContext)>(
#RequireNodeType<Node, (P4Type, CompilerContext)>(
node: node, type: "action_declaration", nice_type_name: "Action Declaration")
var walker = Walker(node: node)
@@ -619,7 +619,7 @@ extension TableKeyEntry: Compilable {
node: SwiftTreeSitter.Node, withContext context: CompilerContext
) -> Common.Result<(P4Lang.TableKeyEntry, CompilerContext)> {
#RequireNodeType<Node, (P4DataType, CompilerContext)>(
#RequireNodeType<Node, (P4Type, CompilerContext)>(
node: node, type: "table_key_entry", nice_type_name: "Table Key Entry")
var walker = Walker(node: node)
@@ -782,7 +782,7 @@ extension TablePropertyList: Compilable {
node: SwiftTreeSitter.Node, withContext context: CompilerContext
) -> Common.Result<(P4Lang.TablePropertyList, CompilerContext)> {
#RequireNodeType<Node, (P4DataType, CompilerContext)>(
#RequireNodeType<Node, (P4Type, CompilerContext)>(
node: node, type: "table_property_list", nice_type_name: "Table Property List")
var current_context = context
@@ -851,7 +851,7 @@ extension Table: Compilable {
) -> Common.Result<(P4Lang.Table, CompilerContext)> {
let table_declaration_node = node
#RequireNodeType<Node, (P4DataType, CompilerContext)>(
#RequireNodeType<Node, (P4Type, CompilerContext)>(
node: table_declaration_node, type: "table_declaration", nice_type_name: "Table Declaration")
var walker = Walker(node: table_declaration_node)
+1 -1
View File
@@ -35,7 +35,7 @@ public protocol CompilableValue {
public protocol CompilableType {
static func CompileType(
type: SwiftTreeSitter.Node, withContext: CompilerContext
) -> Result<P4DataType?>
) -> Result<P4Type?>
}
public protocol CompilableDeclaration {
+4 -4
View File
@@ -25,7 +25,7 @@ import TreeSitterP4
extension P4Boolean: CompilableType {
public static func CompileType(
type: SwiftTreeSitter.Node, withContext: CompilerContext
) -> Common.Result<(any Common.P4DataType)?> {
) -> Common.Result<(any Common.P4Type)?> {
return type.text == "bool" ? .Ok(P4Boolean()) : .Ok(.none)
}
}
@@ -33,7 +33,7 @@ extension P4Boolean: CompilableType {
extension P4Int: CompilableType {
public static func CompileType(
type: SwiftTreeSitter.Node, withContext: CompilerContext
) -> Common.Result<(any Common.P4DataType)?> {
) -> Common.Result<(any Common.P4Type)?> {
return type.text == "int" ? .Ok(P4Int()) : .Ok(.none)
}
}
@@ -41,7 +41,7 @@ extension P4Int: CompilableType {
extension P4String: CompilableType {
public static func CompileType(
type: SwiftTreeSitter.Node, withContext: CompilerContext
) -> Common.Result<(any Common.P4DataType)?> {
) -> Common.Result<(any Common.P4Type)?> {
return type.text == "string" ? .Ok(P4String()) : .Ok(.none)
}
}
@@ -49,7 +49,7 @@ extension P4String: CompilableType {
extension P4Struct: CompilableType {
public static func CompileType(
type: SwiftTreeSitter.Node, withContext context: CompilerContext
) -> Common.Result<(any Common.P4DataType)?> {
) -> Common.Result<(any Common.P4Type)?> {
let maybe_parsed_type_id = Identifier.Compile(node: type, withContext: context)
guard case .Ok(let parsed_type_id) = maybe_parsed_type_id else {