File tree Expand file tree Collapse file tree 3 files changed +8
-7
lines changed
scripts/extension_api_parser Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ class NativeStructureSpec:
101101 format : str
102102
103103 @classmethod
104- def parse (cls , item : dict ) -> "GlobalEnumSpec " :
104+ def parse (cls , item : dict ) -> "NativeStructureSpec " :
105105 item .setdefault ("original_name" , item ["name" ])
106106 assert_api_consistency (cls , item )
107107 return cls (
Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ def parse(cls, item: dict) -> "BuiltinOperatorSpec":
154154 # used to represent the absence of a value (typically in a return type),
155155 # but here we want to compare a builtin value with the constant representing
156156 # emptiness.
157- right_type = TypeInUse (item ["right_type" ]) if item [ "right_type" ] is not None else None ,
157+ right_type = TypeInUse (item ["right_type" ]),
158158 return_type = TypeInUse (item ["return_type" ]),
159159 )
160160
@@ -253,7 +253,7 @@ class BuiltinSpec:
253253 c_struct_name : str
254254 original_name : str
255255 is_scalar : bool
256- size : Optional [ int ]
256+ size : int
257257 indexing_return_type : Optional [str ]
258258 is_keyed : bool
259259 constructors : List [BuiltinConstructorSpec ]
@@ -266,7 +266,7 @@ class BuiltinSpec:
266266 enums : List [BuiltinEnumSpec ]
267267
268268 @property
269- def c_struct_members (self ) -> List [Tuple [ str , TypeInUse ] ]:
269+ def c_struct_members (self ) -> List [BuiltinMemberSpec ]:
270270 struct_members = [m for m in self .members if m .offset is not None ]
271271 if struct_members :
272272 # Sanity check
Original file line number Diff line number Diff line change @@ -193,7 +193,8 @@ def register_builtins_in_types_db(builtins: Iterable["BuiltinSpec"]) -> None:
193193 # `BuiltinOperatorSpec.right_type` and in `ValueInUse`.
194194 # So better skip it and use ad-hoc workaround instead.
195195 continue
196- elif spec .name == "bool" :
196+ assert spec .size is not None
197+ if spec .name == "bool" :
197198 ts = TypeSpec (
198199 size = spec .size ,
199200 gdapi_type = spec .original_name ,
@@ -282,7 +283,7 @@ class TypeInUse:
282283
283284 def __repr__ (self ) -> str :
284285 try :
285- resolved = self .resolve ()
286+ resolved = TYPES_DB [ self .type_name ]
286287 except KeyError :
287288 resolved = "<not resolved yet>"
288289 return f"{ self .__class__ .__name__ } ({ self .type_name } , { resolved } )"
@@ -293,7 +294,7 @@ def resolve(self) -> TypeSpec:
293294 try :
294295 return TYPES_DB [self .type_name ]
295296 except KeyError :
296- return
297+ raise RuntimeError ( f"Type { self . type_name } is not resolvable yet !" )
297298
298299 def __getattr__ (self , name : str ):
299300 try :
You can’t perform that action at this time.
0 commit comments