WIP functions processing

This commit is contained in:
2025-08-31 05:12:47 +05:30
parent b4a2f169ad
commit a8e7a42b72
5 changed files with 76 additions and 4 deletions

View File

@ -12,12 +12,13 @@ def emit_license(module: ir.Module, license_str: str):
gvar.align = 1 # type: ignore
gvar.linkage = "dso_local" # type: ignore
gvar.global_constant = False # must be global, not constant
gvar.global_constant = False
gvar.section = "license" # type: ignore
return gvar
def license_processing(tree, module):
"""Process the LICENSE assignment in the given AST tree and return the section name"""
count = 0
for node in tree.body:
if isinstance(node, ast.Assign):
@ -27,7 +28,10 @@ def license_processing(tree, module):
count += 1
if isinstance(node.value, ast.Constant) and isinstance(node.value.value, str):
emit_license(module, node.value.value)
return "LICENSE"
else:
print("ERROR: LICENSE must be a string literal")
return None
else:
print("ERROR: LICENSE already assigned")
return None