Skip to content

erlcapnp cheats when encoding lists of text fields #3

@bucko909

Description

@bucko909
ast_encode_ptr(N, PtrLen0, #ptr_type{type=list, extra={text, TextType}}, VarName, Line) ->
    % This is a bit of a hack; we encode a list of text fields as a list of structs which have the first field being text.
    % They should really be anyPointer, I think, which doesn't need a header tag word.

This instructs to use ast_encode_struct_list_/3 to encode the text list.

Should really have an ast_encode_ptr_list_/1 which takes EncodeFun only.

That function should be functionally identical except that:

  • It should not add a tag word.
  • It should assume StructLen is 1 (each element of the list is just a single pointer).

There should also be a test to make sure this works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions