Fixed issue parsing grib_section member [parent]

This commit is contained in:
kevstone 2024-02-11 09:22:44 +00:00
parent e23dcdd798
commit 0824ea8865
1 changed files with 9 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import code_object.function_call as function_call
import code_object_converter.conversion_pack.arg_utils as arg_utils
import code_object.cast_expression as cast_expression
import code_object.macro_instantation as macro_instantation
import code_object.struct_member_access as struct_member_access
from utils.string_funcs import strip_semicolon
from grib_accessor.grib_accessor_conversion_pack.grib_accessor_special_function_call_conversion import special_function_name_mapping
@ -222,6 +223,14 @@ class GribAccessorConversionValidation(default_conversion_validation.DefaultConv
data_member = cppstruct_member_access.member
if data_member.name == "name":
data_member.name += "().get().c_str()" # It's read-only so this is ok!
if data_member.name == "parent":
# For now we'll strip off the parent bit as that is accessing the grib_section, which we'll probably get
# another way!
updated_cppstruct_member_access = struct_member_access.StructMemberAccess(cppstruct_member_access.access,
cppstruct_member_access.name,
cppstruct_member_access.index)
debug.line("validate_struct_member_access", f"Updating AccessorPtr grib_section access: [{debug.as_debug_string(cppstruct_member_access)}]->[{updated_cppstruct_member_access}]")
return updated_cppstruct_member_access
return super().validate_struct_member_access(cstruct_member_access, cppstruct_member_access)