Fix properties renaming.

This commit is contained in:
2024-06-12 12:31:30 +02:00
parent 27acd6820c
commit 262f0d632a
4 changed files with 18 additions and 7 deletions

View File

@@ -49,7 +49,6 @@ emit_field :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
print_to_builder(*state.builder, "%", node.name);
for i :0..node.children.count - 1 {
child := node.children[i];
print_to_builder(*state.builder, " = ");
@@ -278,8 +277,7 @@ emit_node :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
indent(*state.builder, indentation);
type_var := h2tv(state.type_variables, node.type_variable);
print("type: %\n", type_var.typename);
is_properties := node.name == "properties";
is_properties := type_var.typename == "properties";
if !is_properties {
print_to_builder(*state.builder, "%", node.name);
@@ -394,7 +392,6 @@ codegen :: (state : *Codegen_State) -> Codegen_Result {
state.result.result_text = builder_to_string(*state.builder);
print("%\n", state.result.result_text);
return state.result;
}

View File

@@ -55,7 +55,6 @@ p :: properties {
...
}
```
But this is not yet supported 100%.
## Jai Usage Example
@@ -171,7 +170,7 @@ Hint_Kind :: enum {
## Notable missing features
- Control flow: if/else, for, while etc.
- Control flow: if/else, for, while, switch etc.
- Arrays
- Textures and samplers
- Multiple render targets

View File

@@ -1204,7 +1204,7 @@ create_variable :: (checker : *Semantic_Checker, node : *AST_Node, field_parent
field_access_on_primitive_type(checker, node, find_result.type_variable);
return 0;
} else {
lookup_name : string;
lookup_name : string = variable.typename;
if variable.typename == "properties" {
lookup_name = variable.name;
}

View File

@@ -0,0 +1,15 @@
cbuffer __PROPERTIES : register(b0)
{
float4 color;
}
float4 vs_main(float4 pos : POSITION) : SV_POSITION
{
return pos;
}
float4 ps_main() : SV_TARGET
{
return color;
}