Fixed variable parsing issue

This commit is contained in:
kevstone 2024-02-02 08:06:31 +00:00
parent 48b7cadeca
commit 8633a3e9c5
2 changed files with 11 additions and 2 deletions

View File

@ -22,6 +22,7 @@ import code_object.unary_expression as unary_expression
import code_object.unary_operation as unary_operation
import code_object.value_declaration_reference as value_declaration_reference
import code_object.variable_declaration as variable_declaration
from code_object.code_interface import NONE_VALUE
# Parse AstCode and create code interface objects: classes that implement the CodeInterface
#
@ -408,10 +409,18 @@ class AstParser:
cvalue = None
for child in node.get_children():
if child.kind.is_expression():
cvalue = self.parse_ast_node(child)
cvalue = self.parse_ast_node(child)
else:
debug.line("parse_VAR_DECL", f"Ignoring child spelling=[{child.spelling}] type=[{child.type.spelling}] kind=[{child.kind}]")
debug.line("parse_VAR_DECL", f"DEBUG: cvariable type=[{type(cvariable)}.__NAME__] as_string=[{debug.as_debug_string(cvariable)}]")
debug.line("parse_VAR_DECL", f"DEBUG: cvalue type=[{type(cvalue)}.__NAME__] as_string=[{debug.as_debug_string(cvalue)}]")
if not cvalue:
debug.line("parse_VAR_DECL", f"Ignoring cvalue with type=[{cvalue}]")
return None
return variable_declaration.VariableDeclaration(cvariable, cvalue)
parse_DECL_funcs = {

View File

@ -4,7 +4,7 @@ from code_object.code_interface import CodeInterface
func_pad = 30
debug_enabled = True
debug_filter_include = [] #["convert_global_declarations", "dump_function"]
debug_filter_include = []
debug_filter_exclude = []
show_time = False