-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Labels
Description
I'm trying to use -webide-representation to display the values of a parameterized type. My guess is that it isn't supported, but I was kind of hoping there might be a way to make it work -- it's similar but not identical to the example using MACH-O on the website. My type definition is:
fortran_record:
params:
- id: num_records
type: u4
- id: record_type
type: str
seq:
- id: rec_size1
type: u4
- id: value
type:
switch-on: record_type
cases:
'"u4"': u4
'"u8"': u8
'"f4"': f4
'"f8"': f8
repeat: expr
repeat-expr: num_records
- id: rec_size2
type: u4
-webide-representation: "{value}"When it parses, it throws this error:
Parse error (TypeError): Cannot read properties of undefined (reading 'ksyType')
Call stack: TypeError: Cannot read properties of undefined (reading 'ksyType')
at ParsedTreeHandler.reprObject (https://ide.kaitai.io/js/v1/parsedToTree.js:81:35)
at https://ide.kaitai.io/js/v1/parsedToTree.js:119:65
at Array.map (<anonymous>)
at https://ide.kaitai.io/js/v1/parsedToTree.js:119:48
at [Symbol.replace] (<anonymous>)
at String.replace (<anonymous>)
at ParsedTreeHandler.reprObject (https://ide.kaitai.io/js/v1/parsedToTree.js:85:45)
at ParsedTreeHandler.childItemToNode (https://ide.kaitai.io/js/v1/parsedToTree.js:145:33)
at https://ide.kaitai.io/js/v1/parsedToTree.js:189:70
at Array.map (<anonymous>)
at ParsedTreeHandler.exportedToNodes (https://ide.kaitai.io/js/v1/parsedToTree.js:189:48)
at https://ide.kaitai.io/js/v1/parsedToTree.js:267:34
My assumption is that the representation generation is being called before the type gets added as a property on the object by the switch statement, but perhaps that's wrong. I've tried a few different things, like using {value[0]} and whatnot, but it didn't quite work. Any ideas, or will this just require efforts along the same lines as kaitai-io/kaitai_struct#1073 ? Thanks!