Add nullable attribute to AST nodes for function parameters in API introspection. Fixes #309

This change introduces an `nullable` flag to `ArrayType`, `PointerType`, and `FunctionParameterDecl`. The code generation process now parses function comments from `mujoco.h` to identify parameters marked as "Nullable" and sets this flag accordingly.

PiperOrigin-RevId: 797870883
Change-Id: Ic7cac5a7a9c14177fbf97b8655c5c4809d4ef683
This commit is contained in:
Google DeepMind
2025-08-21 12:33:58 -07:00
committed by Copybara-Service
parent 3dec35a91e
commit ecfe65242f
5 changed files with 148 additions and 10 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ class FunctionsTest(absltest.TestCase):
name='oldpos', type=type_parsing.parse_type('const mjtNum[3]')),
ast_nodes.FunctionParameterDecl(
name='rotnew2old',
type=type_parsing.parse_type('const mjtNum[9]'))))
type=type_parsing.parse_type('const mjtNum[9]'), nullable=True)))
self.assertEqual(
func_decl.doc, 'Coordinate transform of 6D motion or force vector in ' +
'rotation:translation format. rotnew2old is 3-by-3, ' +