Skip to content

Commit 493033f

Browse files
committed
cs.Struct._subcons and cs.FocusedSeq._subcons are now correctly updated and accessable
1 parent bcffd9e commit 493033f

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
## [Unreleased]
33
Enhanced ConstructEditor:
44
- `cs.Bytes`, `cs.GreedyBytes`, `cs.Array`, `cs.GreedyRange` now use the length of the object instead of evaluating the length using the saved context. The problem was, that in some cases the context is dyamically created and modified while parsing. So it is not save to use it afterwarts.
5+
- `cs.Struct._subcons` and `cs.FocusedSeq._subcons` are now correctly updated and accessable
56

67
-------------------------------------------------------------------------------
78
## [0.1.0] - 2023-01-03

construct_editor/core/preprocessor.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ def _build(self, obj, stream, context, path):
125125
buildret = self.subcon._build(obj, stream, context, path) # type: ignore
126126
return obj
127127

128+
# passthrought attribute access
129+
def __getattr__(self, name):
130+
return getattr(self.subcon, name)
128131

129132
# #############################################################################
130133
def include_metadata(
@@ -206,6 +209,7 @@ def include_metadata(
206209
for subcon in constr.subcons:
207210
new_subcons.append(include_metadata(subcon, bitwise))
208211
constr.subcons = new_subcons
212+
constr._subcons = cs.Container((sc.name,sc) for sc in constr.subcons if sc.name)
209213
return IncludeGuiMetaData(constr, bitwise)
210214

211215
# FocusedSeq ##############################################################
@@ -215,6 +219,7 @@ def include_metadata(
215219
for subcon in constr.subcons:
216220
new_subcons.append(include_metadata(subcon, bitwise))
217221
constr.subcons = new_subcons
222+
constr._subcons = cs.Container((sc.name,sc) for sc in constr.subcons if sc.name)
218223
return IncludeGuiMetaData(constr, bitwise)
219224

220225
# Select ##################################################################

0 commit comments

Comments
 (0)