Skip to content
Snippets Groups Projects
Commit bd5cadf2 authored by Sven M. Hallberg's avatar Sven M. Hallberg
Browse files

put a type assert macro for the sequence in H_INDEX/H_FIELD

this way the assert will fire from the user's code rather than the one in
glue.c:h_seq_index() which is not informative without a stack trace.
parent 1e7f32f5
No related branches found
No related tags found
No related merge requests found
...@@ -247,7 +247,7 @@ HParsedToken *h_seq_index_vpath(const HParsedToken *p, size_t i, va_list va); ...@@ -247,7 +247,7 @@ HParsedToken *h_seq_index_vpath(const HParsedToken *p, size_t i, va_list va);
#define H_INDEX_BYTES(SEQ, ...) H_CAST_BYTES(H_INDEX_TOKEN(SEQ, __VA_ARGS__)) #define H_INDEX_BYTES(SEQ, ...) H_CAST_BYTES(H_INDEX_TOKEN(SEQ, __VA_ARGS__))
#define H_INDEX_SINT(SEQ, ...) H_CAST_SINT(H_INDEX_TOKEN(SEQ, __VA_ARGS__)) #define H_INDEX_SINT(SEQ, ...) H_CAST_SINT(H_INDEX_TOKEN(SEQ, __VA_ARGS__))
#define H_INDEX_UINT(SEQ, ...) H_CAST_UINT(H_INDEX_TOKEN(SEQ, __VA_ARGS__)) #define H_INDEX_UINT(SEQ, ...) H_CAST_UINT(H_INDEX_TOKEN(SEQ, __VA_ARGS__))
#define H_INDEX_TOKEN(SEQ, ...) h_seq_index_path(SEQ, __VA_ARGS__, -1) #define H_INDEX_TOKEN(SEQ, ...) h_seq_index_path(H_ASSERT_SEQ(SEQ), __VA_ARGS__, -1)
// Standard short-hand to access and cast elements on a sequence token. // Standard short-hand to access and cast elements on a sequence token.
#define H_FIELD(TYP, ...) H_INDEX(TYP, p->ast, __VA_ARGS__) #define H_FIELD(TYP, ...) H_INDEX(TYP, p->ast, __VA_ARGS__)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment