gabbhack/deser

Divide the parsing stage into parsing and processing

gabbhack opened this issue · 0 comments

Problem

Now a lot of modifying operations occur at the parsing stage. It's not logical.

Merging parent fields into current object:

if Some(@parentTypeSym) ?= parentTypeSym:
let parentTypeInfo = TypeInfo.fromTypeSym(parentTypeSym)
if Some(@parentRecList) ?= parentTypeInfo.recList:
if Some(@recListValue) ?= recList:
recList = some mergeRecList(parentRecList, recListValue)
else:
recList = some parentRecList
if Some(@parentPragma) ?= parentTypeInfo.pragma:
if Some(@pragmaValue) ?= pragma:
pragma = some mergePragma(pragmaValue, parentPragma)
else:
pragma = some parentPragma

Merging other cases to the first case:

firstCaseField.get().merge(field)

The operation of "flattening" the fields occurs at the stage of initialization of the structure.

flattenFields: flatten fields,

Possible solution

Divide the parsing stage into two steps

References

No response

Code example

No response

Additional information

No response