Fix lvalue/rvalue binaries. Fix structured buffer output.
This commit is contained in:
4
test/check/for_index_outside.golden
Normal file
4
test/check/for_index_outside.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
[1;37mtest/for_index_outside.ink:6,0: [31merror: [37mUse of undeclared symbol 'i'
|
||||
[96m i += 1;
|
||||
^
|
||||
[36m[37m
|
||||
8
test/check/rvalue_binary.golden
Normal file
8
test/check/rvalue_binary.golden
Normal file
@@ -0,0 +1,8 @@
|
||||
scope (global) [
|
||||
[vertex__vs_main] : ()
|
||||
scope (vertex__vs_main) [
|
||||
[b] : float2
|
||||
[x] : float
|
||||
[a] : float2
|
||||
]
|
||||
]
|
||||
6
test/check/temp_access.golden
Normal file
6
test/check/temp_access.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
[1;37mtest/temp_access.ink:5,10: [31merror: [37mCannot assign to an lvalue.
|
||||
[96m (a + b).x = 2.0;
|
||||
^^^^^^^^^^^
|
||||
|
||||
|
||||
[36m[37m
|
||||
@@ -28,12 +28,14 @@ test/non_bool_cond.ink check
|
||||
test/pass_and_access_struct_fields_in_functions.ink check
|
||||
test/passthrough.ink check
|
||||
test/redeclared_variable.ink check
|
||||
test/rvalue_binary.ink check
|
||||
test/simple_else_if.ink check
|
||||
test/simple_if_else.ink check
|
||||
test/simple_if.ink check
|
||||
test/simple_struct_access.ink check
|
||||
test/struct_access_primitive_type.ink check
|
||||
test/struct_within_struct.ink check
|
||||
test/temp_access.ink check
|
||||
test/type_as_variable_name.ink check
|
||||
test/unary.ink check
|
||||
test/undeclared_function.ink check
|
||||
|
||||
7
test/codegen/rvalue_binary.golden
Normal file
7
test/codegen/rvalue_binary.golden
Normal file
@@ -0,0 +1,7 @@
|
||||
void vs_main()
|
||||
{
|
||||
float2 a;
|
||||
float2 b;
|
||||
float x = (a + b).x;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ test/multiple_semicolons_everywhere.ink codegen
|
||||
test/nested_if.ink codegen
|
||||
test/pass_and_access_struct_fields_in_functions.ink codegen
|
||||
test/passthrough.ink codegen
|
||||
test/rvalue_binary.ink codegen
|
||||
test/simple_else_if.ink codegen
|
||||
test/simple_if_else.ink codegen
|
||||
test/simple_if.ink codegen
|
||||
|
||||
@@ -20,6 +20,7 @@ test/multiple_functions.ink compile
|
||||
test/multiple_semicolons_everywhere.ink compile
|
||||
test/pass_and_access_struct_fields_in_functions.ink compile
|
||||
test/passthrough.ink compile
|
||||
test/rvalue_binary.ink compile
|
||||
test/simple_else_if.ink compile
|
||||
test/simple_if_else.ink compile
|
||||
test/simple_if.ink compile
|
||||
|
||||
7
test/for_index_outside.ink
Normal file
7
test/for_index_outside.ink
Normal file
@@ -0,0 +1,7 @@
|
||||
vertex main :: () {
|
||||
for i : 0..10 {
|
||||
x : float;
|
||||
}
|
||||
|
||||
i += 1;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 1 line = 1 ; column = 0 ; value ='p'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 2 ; length = 2 line = 1 ; column = 2 ; value ='::'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 5 ; length = 15 line = 1 ; column = 5 ; value ='constant_buffer'; }
|
||||
{kind = TOKEN_CONSTANT_BUFFER; ; index = 5 ; length = 15 line = 1 ; column = 5 ; value ='Constant_Buffer'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 21 ; length = 1 line = 1 ; column = 21 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 25 ; length = 1 line = 2 ; column = 0 ; value ='v'; }
|
||||
{kind = TOKEN_COLON; ; index = 27 ; length = 1 line = 2 ; column = 2 ; value =':'; }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 1 line = 1 ; column = 0 ; value ='p'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 2 ; length = 2 line = 1 ; column = 2 ; value ='::'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 5 ; length = 15 line = 1 ; column = 5 ; value ='constant_buffer'; }
|
||||
{kind = TOKEN_CONSTANT_BUFFER; ; index = 5 ; length = 15 line = 1 ; column = 5 ; value ='Constant_Buffer'; }
|
||||
{kind = TOKEN_AT; ; index = 21 ; length = 1 line = 1 ; column = 21 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 10 line = 1 ; column = 22 ; value ='properties'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 33 ; length = 1 line = 1 ; column = 33 ; value ='{'; }
|
||||
|
||||
27
test/lex/rvalue_binary.golden
Normal file
27
test/lex/rvalue_binary.golden
Normal file
@@ -0,0 +1,27 @@
|
||||
{kind = TOKEN_VERTEX; ; index = 0 ; length = 6 line = 1 ; column = 0 ; value ='vertex'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 7 ; length = 4 line = 1 ; column = 7 ; value ='main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 12 ; length = 2 line = 1 ; column = 12 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 15 ; length = 1 line = 1 ; column = 15 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 1 line = 2 ; column = 0 ; value ='a'; }
|
||||
{kind = TOKEN_COLON; ; index = 24 ; length = 1 line = 2 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 26 ; length = 6 line = 2 ; column = 4 ; value ='float2'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 32 ; length = 1 line = 2 ; column = 10 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 36 ; length = 1 line = 3 ; column = 0 ; value ='b'; }
|
||||
{kind = TOKEN_COLON; ; index = 38 ; length = 1 line = 3 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 40 ; length = 6 line = 3 ; column = 4 ; value ='float2'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 46 ; length = 1 line = 3 ; column = 10 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 52 ; length = 1 line = 5 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_COLON; ; index = 54 ; length = 1 line = 5 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 55 ; length = 1 line = 5 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 57 ; length = 1 line = 5 ; column = 5 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 58 ; length = 1 line = 5 ; column = 6 ; value ='a'; }
|
||||
{kind = TOKEN_PLUS; ; index = 60 ; length = 1 line = 5 ; column = 8 ; value ='+'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 62 ; length = 1 line = 5 ; column = 10 ; value ='b'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 63 ; length = 1 line = 5 ; column = 11 ; value =')'; }
|
||||
{kind = TOKEN_DOT; ; index = 64 ; length = 1 line = 5 ; column = 12 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 65 ; length = 1 line = 5 ; column = 13 ; value ='x'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 66 ; length = 1 line = 5 ; column = 14 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 69 ; length = 1 line = 6 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 72 ; length = 0 line = 7 ; column = 0 ; value =''; }
|
||||
26
test/lex/temp_access.golden
Normal file
26
test/lex/temp_access.golden
Normal file
@@ -0,0 +1,26 @@
|
||||
{kind = TOKEN_VERTEX; ; index = 0 ; length = 6 line = 1 ; column = 0 ; value ='vertex'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 7 ; length = 4 line = 1 ; column = 7 ; value ='main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 12 ; length = 2 line = 1 ; column = 12 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 15 ; length = 1 line = 1 ; column = 15 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 1 line = 2 ; column = 0 ; value ='a'; }
|
||||
{kind = TOKEN_COLON; ; index = 24 ; length = 1 line = 2 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 26 ; length = 6 line = 2 ; column = 4 ; value ='float2'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 32 ; length = 1 line = 2 ; column = 10 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 36 ; length = 1 line = 3 ; column = 0 ; value ='b'; }
|
||||
{kind = TOKEN_COLON; ; index = 38 ; length = 1 line = 3 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 40 ; length = 6 line = 3 ; column = 4 ; value ='float2'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 46 ; length = 1 line = 3 ; column = 10 ; value =';'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 52 ; length = 1 line = 5 ; column = 0 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 53 ; length = 1 line = 5 ; column = 1 ; value ='a'; }
|
||||
{kind = TOKEN_PLUS; ; index = 55 ; length = 1 line = 5 ; column = 3 ; value ='+'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 57 ; length = 1 line = 5 ; column = 5 ; value ='b'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 58 ; length = 1 line = 5 ; column = 6 ; value =')'; }
|
||||
{kind = TOKEN_DOT; ; index = 59 ; length = 1 line = 5 ; column = 7 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 60 ; length = 1 line = 5 ; column = 8 ; value ='x'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 62 ; length = 1 line = 5 ; column = 10 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 64 ; length = 3 line = 5 ; column = 12 ; value ='2'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 67 ; length = 1 line = 5 ; column = 15 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 70 ; length = 1 line = 6 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 73 ; length = 0 line = 7 ; column = 0 ; value =''; }
|
||||
@@ -36,12 +36,14 @@ test/non_bool_cond.ink lex
|
||||
test/pass_and_access_struct_fields_in_functions.ink lex
|
||||
test/passthrough.ink lex
|
||||
test/redeclared_variable.ink lex
|
||||
test/rvalue_binary.ink lex
|
||||
test/simple_else_if.ink lex
|
||||
test/simple_if_else.ink lex
|
||||
test/simple_if.ink lex
|
||||
test/simple_struct_access.ink lex
|
||||
test/struct_access_primitive_type.ink lex
|
||||
test/struct_within_struct.ink lex
|
||||
test/temp_access.ink lex
|
||||
test/type_as_variable_name.ink lex
|
||||
test/unary.ink lex
|
||||
test/undeclared_function.ink lex
|
||||
|
||||
6
test/parse/rvalue_binary.golden
Normal file
6
test/parse/rvalue_binary.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= a float2)
|
||||
(:= b float2)
|
||||
(:= x (+ a b).x)))
|
||||
6
test/parse/temp_access.golden
Normal file
6
test/parse/temp_access.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= a float2)
|
||||
(:= b float2)
|
||||
(= (+ a b).x 2)))
|
||||
@@ -36,12 +36,14 @@ test/non_bool_cond.ink parse
|
||||
test/pass_and_access_struct_fields_in_functions.ink parse
|
||||
test/passthrough.ink parse
|
||||
test/redeclared_variable.ink parse
|
||||
test/rvalue_binary.ink parse
|
||||
test/simple_else_if.ink parse
|
||||
test/simple_if_else.ink parse
|
||||
test/simple_if.ink parse
|
||||
test/simple_struct_access.ink parse
|
||||
test/struct_access_primitive_type.ink parse
|
||||
test/struct_within_struct.ink parse
|
||||
test/temp_access.ink parse
|
||||
test/type_as_variable_name.ink parse
|
||||
test/unary.ink parse
|
||||
test/undeclared_function.ink parse
|
||||
|
||||
6
test/rvalue_binary.ink
Normal file
6
test/rvalue_binary.ink
Normal file
@@ -0,0 +1,6 @@
|
||||
vertex main :: () {
|
||||
a : float2;
|
||||
b : float2;
|
||||
|
||||
x := (a + b).x;
|
||||
}
|
||||
6
test/temp_access.ink
Normal file
6
test/temp_access.ink
Normal file
@@ -0,0 +1,6 @@
|
||||
vertex main :: () {
|
||||
a : float2;
|
||||
b : float2;
|
||||
|
||||
(a + b).x = 2.0;
|
||||
}
|
||||
Reference in New Issue
Block a user