Skip to content

Commit

Permalink
[UR] Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Vesely committed Jun 21, 2023
1 parent 3cb7b81 commit dd59867
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 4 additions & 3 deletions scripts/core/CONTRIB.rst
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,10 @@ implement your experimental feature.
Experimental features *must* not make any changes to the core YaML files and
*must* be described entirely in their own YaML file. Sometimes, however
experimental feature require extending enumerations of the core specification.
If this is necessary should set the `extend` field to true and list the required
enumerations to support the experimental feature. These additional enumerations
will updated the specification with the appropriate values.
If this is necessary, create a new enum with the ``extend`` field set to true
and list the required enumerations to support the experimental feature. These
additional enumerations will updated the specification with the appropriate
values.


Naming Convention
Expand Down
8 changes: 7 additions & 1 deletion scripts/parse_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,13 @@ def refresh_enum_meta(obj, header, meta):


def handle_enum_extensions(d, specs, header, meta):
matching_enum = [obj for s in specs for obj in s['objects'] if obj['type'] == 'enum' and d['name'] == obj['name']][0]
matching_enums = [obj for s in specs for obj in s['objects'] if obj['type'] == 'enum' and d['name'] == obj['name'] and not obj.get('extend')]
if len(matching_enums) != 1:
raise Exception(f"""
Could not find matching enum to extend {d['name']}.
You should check the ordinal value of the headers to ensure that the enum
is defined before you extend it.""")
matching_enum = matching_enums[0]
matching_enum['etors'].extend(d['etors'])

## Refresh metadata
Expand Down

0 comments on commit dd59867

Please sign in to comment.