symforce icon indicating copy to clipboard operation
symforce copied to clipboard

Add format_matrix_subscript_accessor and update_template_data to CodegenConfig

Open gareth-cross opened this issue 3 years ago • 1 comments

This review adds two small methods to CodegenConfig, with the intention of making it easier to support additional languages:

  • format_matrix_subscript_accessor, which formats the accessor for 2D matrices. This is required in some languages where the foo(i, j) syntax is unavailable. In keeping w/ Hayk's comment on format_data_accessor, I put a TODO suggesting this could potentially be moved into the code-printer itself.
  • update_template_data, which allows CodegenConfig subclasses to pass additional fields or functions to the templating engine.

gareth-cross avatar Jun 30 '22 00:06 gareth-cross

I think we'll need to remove the format_matrix_subscript_accessor change from here since it's a duplicate with #190 which makes the other required changes with matrix_is_1d and have this PR just make the update_template_data change

aaron-skydio avatar Jul 12 '22 03:07 aaron-skydio