Multiple small fixes
- Foreign functions can now have names for parameters - Fix property renaming crash - Properly output texture sampling calls
This commit is contained in:
30
Codegen.jai
30
Codegen.jai
@@ -80,18 +80,40 @@ emit_block :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
|
||||
emit_call :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
indent(state, indentation);
|
||||
print_to_builder(*state.builder, "%(", node.name);
|
||||
|
||||
if node.children.count > 0 {
|
||||
if node.name == "sample" {
|
||||
assert(node.children.count > 0);
|
||||
args := node.children[0];
|
||||
|
||||
for child : args.children {
|
||||
emit_node(state, args.children[0], 0);
|
||||
append(*state.builder, ".");
|
||||
print_to_builder(*state.builder, "%(", node.name);
|
||||
|
||||
for i : 1..args.children.count - 1 {
|
||||
child := args.children[i];
|
||||
|
||||
emit_node(state, child, 0);
|
||||
|
||||
if it_index != args.children.count - 1 {
|
||||
if i != args.children.count - 1 {
|
||||
append(*state.builder, ", ");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
print_to_builder(*state.builder, "%(", node.name);
|
||||
|
||||
if node.children.count > 0 {
|
||||
args := node.children[0];
|
||||
|
||||
for child : args.children {
|
||||
emit_node(state, child, 0);
|
||||
|
||||
if it_index != args.children.count - 1 {
|
||||
append(*state.builder, ", ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
append(*state.builder, ")");
|
||||
|
||||
Reference in New Issue
Block a user