lang: Clarify that code blocks are functions
This commit is contained in:
parent
c4c189faea
commit
b336dc7ae7
1 changed files with 7 additions and 7 deletions
|
@ -831,7 +831,7 @@ def generate_header(ir, source):
|
|||
]
|
||||
for i in includes:
|
||||
header += "#include %s\n" % i
|
||||
header += "static struct object_class module_class;\n\n"
|
||||
header += "\nstatic struct object_class module_class;\n"
|
||||
return header
|
||||
|
||||
def generate_module_args(module_args):
|
||||
|
@ -872,10 +872,10 @@ static void module_call(VmState state, Object obj, void *priv) {
|
|||
bytecode_run(state, obj, (const unsigned char *)priv, *args);
|
||||
}\n\n"""
|
||||
|
||||
def generate_footer(verbs):
|
||||
def generate_footer(functions):
|
||||
footer = """static struct object_call calls[] = {\n"""
|
||||
for verb in verbs:
|
||||
footer += "\t" + verb + "\n"
|
||||
for function in functions:
|
||||
footer += "\t" + function + "\n"
|
||||
footer += "\t{.name = NULL, /* end */}\n};"
|
||||
footer += """\n
|
||||
static struct object_class module_class = {
|
||||
|
@ -917,19 +917,19 @@ def generate_c_file(module_args, ir, source):
|
|||
output = generate_header(ir, source)
|
||||
output += generate_module_args(module_args)
|
||||
output += generate_callbacks()
|
||||
verbs = []
|
||||
functions = []
|
||||
for node in ir:
|
||||
next = None
|
||||
if isinstance(node, IRMetadata):
|
||||
next = generate_metadata(node)
|
||||
elif isinstance(node, IRFunction):
|
||||
next = generate_bytecode(node)
|
||||
verbs.append(generate_call(node))
|
||||
functions.append(generate_call(node))
|
||||
if next is None:
|
||||
print("Can't generate node: %s" % (node))
|
||||
return None
|
||||
output += next
|
||||
footer = generate_footer(verbs)
|
||||
footer = generate_footer(functions)
|
||||
if footer is None:
|
||||
print("Can't generate footer")
|
||||
return None
|
||||
|
|
Loading…
Add table
Reference in a new issue