Fixed some error handling for invalid if statements. Started if codegen.
This commit is contained in:
10
test/else_if_after_else.ink
Normal file
10
test/else_if_after_else.ink
Normal file
@@ -0,0 +1,10 @@
|
||||
vertex main :: (pos : float3 @position) -> float4 @position {
|
||||
if 0 > 100 {
|
||||
|
||||
} else {
|
||||
|
||||
} else if 0 > 200 {
|
||||
|
||||
}
|
||||
return float4(0.0);
|
||||
}
|
||||
6
test/if_cond_assign.ink
Normal file
6
test/if_cond_assign.ink
Normal file
@@ -0,0 +1,6 @@
|
||||
vertex main :: (pos : float3 @position) -> float4 @position {
|
||||
if 0 = 100 {
|
||||
return float4(pos, 1.0);
|
||||
}
|
||||
return float4(0.0);
|
||||
}
|
||||
6
test/if_if_if.ink
Normal file
6
test/if_if_if.ink
Normal file
@@ -0,0 +1,6 @@
|
||||
vertex main :: (pos : float3 @position) -> float4 @position {
|
||||
if if if 0 > 100 {
|
||||
return float4(pos, 1.0);
|
||||
}
|
||||
return float4(0.0);
|
||||
}
|
||||
39
test/lex/else_if_after_else.golden
Normal file
39
test/lex/else_if_after_else.golden
Normal file
@@ -0,0 +1,39 @@
|
||||
{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_IDENTIFIER; ; index = 16 ; length = 3 line = 1 ; column = 16 ; value ='pos'; }
|
||||
{kind = TOKEN_COLON; ; index = 20 ; length = 1 line = 1 ; column = 20 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 6 line = 1 ; column = 22 ; value ='float3'; }
|
||||
{kind = TOKEN_AT; ; index = 29 ; length = 1 line = 1 ; column = 29 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 30 ; length = 8 line = 1 ; column = 30 ; value ='position'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 38 ; length = 1 line = 1 ; column = 38 ; value =')'; }
|
||||
{kind = TOKEN_ARROW; ; index = 40 ; length = 2 line = 1 ; column = 40 ; value ='->'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 43 ; length = 6 line = 1 ; column = 43 ; value ='float4'; }
|
||||
{kind = TOKEN_AT; ; index = 50 ; length = 1 line = 1 ; column = 50 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 51 ; length = 8 line = 1 ; column = 51 ; value ='position'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 60 ; length = 1 line = 1 ; column = 60 ; value ='{'; }
|
||||
{kind = TOKEN_IF; ; index = 64 ; length = 2 line = 2 ; column = 0 ; value ='if'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 67 ; length = 1 line = 2 ; column = 3 ; value ='0'; }
|
||||
{kind = TOKEN_GREATER; ; index = 69 ; length = 1 line = 2 ; column = 5 ; value ='>'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 71 ; length = 3 line = 2 ; column = 7 ; value ='100'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 75 ; length = 1 line = 2 ; column = 11 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 83 ; length = 1 line = 4 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_ELSE; ; index = 85 ; length = 4 line = 4 ; column = 2 ; value ='else'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 90 ; length = 1 line = 4 ; column = 7 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 99 ; length = 1 line = 6 ; column = 4 ; value ='}'; }
|
||||
{kind = TOKEN_ELSE; ; index = 101 ; length = 4 line = 6 ; column = 6 ; value ='else'; }
|
||||
{kind = TOKEN_IF; ; index = 106 ; length = 2 line = 6 ; column = 11 ; value ='if'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 109 ; length = 1 line = 6 ; column = 14 ; value ='0'; }
|
||||
{kind = TOKEN_GREATER; ; index = 111 ; length = 1 line = 6 ; column = 16 ; value ='>'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 113 ; length = 3 line = 6 ; column = 18 ; value ='200'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 117 ; length = 1 line = 6 ; column = 22 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 123 ; length = 1 line = 8 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_RETURN; ; index = 127 ; length = 6 line = 9 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 134 ; length = 6 line = 9 ; column = 7 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 140 ; length = 1 line = 9 ; column = 13 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 141 ; length = 3 line = 9 ; column = 14 ; value ='0'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 144 ; length = 1 line = 9 ; column = 17 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 145 ; length = 1 line = 9 ; column = 18 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 148 ; length = 1 line = 10 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 151 ; length = 0 line = 11 ; column = 0 ; value =''; }
|
||||
35
test/lex/float_if_cond.golden
Normal file
35
test/lex/float_if_cond.golden
Normal file
@@ -0,0 +1,35 @@
|
||||
{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_IDENTIFIER; ; index = 16 ; length = 3 line = 1 ; column = 16 ; value ='pos'; }
|
||||
{kind = TOKEN_COLON; ; index = 20 ; length = 1 line = 1 ; column = 20 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 6 line = 1 ; column = 22 ; value ='float3'; }
|
||||
{kind = TOKEN_AT; ; index = 29 ; length = 1 line = 1 ; column = 29 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 30 ; length = 8 line = 1 ; column = 30 ; value ='position'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 38 ; length = 1 line = 1 ; column = 38 ; value =')'; }
|
||||
{kind = TOKEN_ARROW; ; index = 40 ; length = 2 line = 1 ; column = 40 ; value ='->'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 43 ; length = 6 line = 1 ; column = 43 ; value ='float4'; }
|
||||
{kind = TOKEN_AT; ; index = 50 ; length = 1 line = 1 ; column = 50 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 51 ; length = 8 line = 1 ; column = 51 ; value ='position'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 60 ; length = 1 line = 1 ; column = 60 ; value ='{'; }
|
||||
{kind = TOKEN_IF; ; index = 64 ; length = 2 line = 2 ; column = 0 ; value ='if'; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 67 ; length = 3 line = 2 ; column = 3 ; value ='1'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 71 ; length = 1 line = 2 ; column = 7 ; value ='{'; }
|
||||
{kind = TOKEN_RETURN; ; index = 76 ; length = 6 line = 3 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 83 ; length = 6 line = 3 ; column = 7 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 89 ; length = 1 line = 3 ; column = 13 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 90 ; length = 3 line = 3 ; column = 14 ; value ='pos'; }
|
||||
{kind = TOKEN_COMMA; ; index = 93 ; length = 1 line = 3 ; column = 17 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 95 ; length = 3 line = 3 ; column = 19 ; value ='1'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 98 ; length = 1 line = 3 ; column = 22 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 99 ; length = 1 line = 3 ; column = 23 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 103 ; length = 1 line = 4 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_RETURN; ; index = 107 ; length = 6 line = 5 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 114 ; length = 6 line = 5 ; column = 7 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 120 ; length = 1 line = 5 ; column = 13 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 121 ; length = 3 line = 5 ; column = 14 ; value ='0'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 124 ; length = 1 line = 5 ; column = 17 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 125 ; length = 1 line = 5 ; column = 18 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 128 ; length = 1 line = 6 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 131 ; length = 0 line = 7 ; column = 0 ; value =''; }
|
||||
37
test/lex/if_cond_assign.golden
Normal file
37
test/lex/if_cond_assign.golden
Normal file
@@ -0,0 +1,37 @@
|
||||
{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_IDENTIFIER; ; index = 16 ; length = 3 line = 1 ; column = 16 ; value ='pos'; }
|
||||
{kind = TOKEN_COLON; ; index = 20 ; length = 1 line = 1 ; column = 20 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 6 line = 1 ; column = 22 ; value ='float3'; }
|
||||
{kind = TOKEN_AT; ; index = 29 ; length = 1 line = 1 ; column = 29 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 30 ; length = 8 line = 1 ; column = 30 ; value ='position'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 38 ; length = 1 line = 1 ; column = 38 ; value =')'; }
|
||||
{kind = TOKEN_ARROW; ; index = 40 ; length = 2 line = 1 ; column = 40 ; value ='->'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 43 ; length = 6 line = 1 ; column = 43 ; value ='float4'; }
|
||||
{kind = TOKEN_AT; ; index = 50 ; length = 1 line = 1 ; column = 50 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 51 ; length = 8 line = 1 ; column = 51 ; value ='position'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 60 ; length = 1 line = 1 ; column = 60 ; value ='{'; }
|
||||
{kind = TOKEN_IF; ; index = 64 ; length = 2 line = 2 ; column = 0 ; value ='if'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 67 ; length = 1 line = 2 ; column = 3 ; value ='0'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 69 ; length = 1 line = 2 ; column = 5 ; value ='='; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 71 ; length = 3 line = 2 ; column = 7 ; value ='100'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 75 ; length = 1 line = 2 ; column = 11 ; value ='{'; }
|
||||
{kind = TOKEN_RETURN; ; index = 80 ; length = 6 line = 3 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 87 ; length = 6 line = 3 ; column = 7 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 93 ; length = 1 line = 3 ; column = 13 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 94 ; length = 3 line = 3 ; column = 14 ; value ='pos'; }
|
||||
{kind = TOKEN_COMMA; ; index = 97 ; length = 1 line = 3 ; column = 17 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 99 ; length = 3 line = 3 ; column = 19 ; value ='1'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 102 ; length = 1 line = 3 ; column = 22 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 103 ; length = 1 line = 3 ; column = 23 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 107 ; length = 1 line = 4 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_RETURN; ; index = 111 ; length = 6 line = 5 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 118 ; length = 6 line = 5 ; column = 7 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 124 ; length = 1 line = 5 ; column = 13 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 125 ; length = 3 line = 5 ; column = 14 ; value ='0'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 128 ; length = 1 line = 5 ; column = 17 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 129 ; length = 1 line = 5 ; column = 18 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 132 ; length = 1 line = 6 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 135 ; length = 0 line = 7 ; column = 0 ; value =''; }
|
||||
39
test/lex/if_if_if.golden
Normal file
39
test/lex/if_if_if.golden
Normal file
@@ -0,0 +1,39 @@
|
||||
{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_IDENTIFIER; ; index = 16 ; length = 3 line = 1 ; column = 16 ; value ='pos'; }
|
||||
{kind = TOKEN_COLON; ; index = 20 ; length = 1 line = 1 ; column = 20 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 6 line = 1 ; column = 22 ; value ='float3'; }
|
||||
{kind = TOKEN_AT; ; index = 29 ; length = 1 line = 1 ; column = 29 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 30 ; length = 8 line = 1 ; column = 30 ; value ='position'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 38 ; length = 1 line = 1 ; column = 38 ; value =')'; }
|
||||
{kind = TOKEN_ARROW; ; index = 40 ; length = 2 line = 1 ; column = 40 ; value ='->'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 43 ; length = 6 line = 1 ; column = 43 ; value ='float4'; }
|
||||
{kind = TOKEN_AT; ; index = 50 ; length = 1 line = 1 ; column = 50 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 51 ; length = 8 line = 1 ; column = 51 ; value ='position'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 60 ; length = 1 line = 1 ; column = 60 ; value ='{'; }
|
||||
{kind = TOKEN_IF; ; index = 64 ; length = 2 line = 2 ; column = 0 ; value ='if'; }
|
||||
{kind = TOKEN_IF; ; index = 67 ; length = 2 line = 2 ; column = 3 ; value ='if'; }
|
||||
{kind = TOKEN_IF; ; index = 70 ; length = 2 line = 2 ; column = 6 ; value ='if'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 73 ; length = 1 line = 2 ; column = 9 ; value ='0'; }
|
||||
{kind = TOKEN_GREATER; ; index = 75 ; length = 1 line = 2 ; column = 11 ; value ='>'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 77 ; length = 3 line = 2 ; column = 13 ; value ='100'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 81 ; length = 1 line = 2 ; column = 17 ; value ='{'; }
|
||||
{kind = TOKEN_RETURN; ; index = 86 ; length = 6 line = 3 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 93 ; length = 6 line = 3 ; column = 7 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 99 ; length = 1 line = 3 ; column = 13 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 100 ; length = 3 line = 3 ; column = 14 ; value ='pos'; }
|
||||
{kind = TOKEN_COMMA; ; index = 103 ; length = 1 line = 3 ; column = 17 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 105 ; length = 3 line = 3 ; column = 19 ; value ='1'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 108 ; length = 1 line = 3 ; column = 22 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 109 ; length = 1 line = 3 ; column = 23 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 113 ; length = 1 line = 4 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_RETURN; ; index = 117 ; length = 6 line = 5 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 124 ; length = 6 line = 5 ; column = 7 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 130 ; length = 1 line = 5 ; column = 13 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 131 ; length = 3 line = 5 ; column = 14 ; value ='0'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 134 ; length = 1 line = 5 ; column = 17 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 135 ; length = 1 line = 5 ; column = 18 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 138 ; length = 1 line = 6 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 141 ; length = 0 line = 7 ; column = 0 ; value =''; }
|
||||
@@ -2,17 +2,21 @@ test/assign_arithmetic_expression.ink lex
|
||||
test/basic_property_and_return_value.ink lex
|
||||
test/complicated_computation.ink lex
|
||||
test/constant_buffer.ink lex
|
||||
test/else_if_after_else.ink lex
|
||||
test/empty_struct.ink lex
|
||||
test/empty_vertex_main.ink lex
|
||||
test/empty_vertex_main_with_position_parameter.ink lex
|
||||
test/field_assignment.ink lex
|
||||
test/field_without_type_specifier.ink lex
|
||||
test/float_suffix.ink lex
|
||||
test/float_if_cond.ink lex
|
||||
test/function_call.ink lex
|
||||
test/function_call_out_of_order_declaration.ink lex
|
||||
test/function_call_return.ink lex
|
||||
test/functions_with_same_name.ink lex
|
||||
test/function_with_int_return.ink lex
|
||||
test/if_cond_assign.ink lex
|
||||
test/if_if_if.ink lex
|
||||
test/inferred_types.ink lex
|
||||
test/meta_block.ink lex
|
||||
test/multiple_functions.ink lex
|
||||
|
||||
4
test/parse/else_if_after_else.golden
Normal file
4
test/parse/else_if_after_else.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
[1;37mtest/else_if_after_else.ink:6,6: [31merror: [37m'else if' without 'if'
|
||||
[96m } else if 0 > 200 {
|
||||
^^^^[97m
|
||||
[36m[37m
|
||||
6
test/parse/float_if_cond.golden
Normal file
6
test/parse/float_if_cond.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
(program
|
||||
(fun vertex vs_main -> float4 (@position)
|
||||
[(:= pos float3 (@position))]
|
||||
(if 1
|
||||
(return (float4 pos 1)))
|
||||
(return (float4 0))))
|
||||
6
test/parse/if_cond_assign.golden
Normal file
6
test/parse/if_cond_assign.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
(program
|
||||
(fun vertex vs_main -> float4 (@position)
|
||||
[(:= pos float3 (@position))]
|
||||
(if (= 0 100)
|
||||
(return (float4 pos 1)))
|
||||
(return (float4 0))))
|
||||
4
test/parse/if_if_if.golden
Normal file
4
test/parse/if_if_if.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
[1;37mtest/if_if_if.ink:2,3: [31merror: [37mExpected expression after 'if'.
|
||||
[96mif if if 0 > 100 {
|
||||
^^
|
||||
[36m[37m
|
||||
@@ -2,17 +2,21 @@ test/assign_arithmetic_expression.ink parse
|
||||
test/basic_property_and_return_value.ink parse
|
||||
test/complicated_computation.ink parse
|
||||
test/constant_buffer.ink parse
|
||||
test/else_if_after_else.ink parse
|
||||
test/empty_struct.ink parse
|
||||
test/empty_vertex_main.ink parse
|
||||
test/empty_vertex_main_with_position_parameter.ink parse
|
||||
test/field_assignment.ink parse
|
||||
test/field_without_type_specifier.ink parse
|
||||
test/float_if_cond.ink parse
|
||||
test/float_suffix.ink parse
|
||||
test/function_call.ink parse
|
||||
test/function_call_out_of_order_declaration.ink parse
|
||||
test/function_call_return.ink parse
|
||||
test/functions_with_same_name.ink parse
|
||||
test/function_with_int_return.ink parse
|
||||
test/if_cond_assign.ink parse
|
||||
test/if_if_if.ink parse
|
||||
test/inferred_types.ink parse
|
||||
test/meta_block.ink parse
|
||||
test/multiple_functions.ink parse
|
||||
|
||||
6
test/semant/float_if_cond.golden
Normal file
6
test/semant/float_if_cond.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
[1;37mtest/float_if_cond.ink:0,0: [31merror: [37mType of expression in if condition has to be bool.
|
||||
[96mif 1.0
|
||||
^^^
|
||||
1.0 has type float
|
||||
|
||||
[36m[37m
|
||||
6
test/semant/if_cond_assign.golden
Normal file
6
test/semant/if_cond_assign.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
[1;37mtest/if_cond_assign.ink:0,0: [31merror: [37mType of expression in if condition has to be bool.
|
||||
[96mif 0 = 100
|
||||
^^^^^^
|
||||
if 0 = 100 { has type int
|
||||
|
||||
[36m[37m
|
||||
6
test/semant/simple_if.golden
Normal file
6
test/semant/simple_if.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
scope (global) [
|
||||
[vertex__vs_main] : (pos : float3) -> float4
|
||||
scope (vertex__vs_main) [
|
||||
[pos] : float3
|
||||
]
|
||||
]
|
||||
6
test/semant/simple_if_else.golden
Normal file
6
test/semant/simple_if_else.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
scope (global) [
|
||||
[vertex__vs_main] : (pos : float3) -> float4
|
||||
scope (vertex__vs_main) [
|
||||
[pos] : float3
|
||||
]
|
||||
]
|
||||
@@ -7,7 +7,20 @@
|
||||
[96m color : float4 = float4(y, 1.0, 1.0, 1.0);
|
||||
^
|
||||
[97m Possible overloads:
|
||||
[96m foreign float4 :: (float, float, float, float) -> float4; (test/wrong_type_for_function.ink:78)
|
||||
[96m foreign float4 :: (float, float, float, float) -> float4; (test/wrong_type_for_function.ink:86)
|
||||
[96m foreign float4 :: (float4) -> float4; (test/wrong_type_for_function.ink:87)
|
||||
[96m foreign float4 :: (float2, float2) -> float4; (test/wrong_type_for_function.ink:88)
|
||||
[96m foreign float4 :: (float2, float, float) -> float4; (test/wrong_type_for_function.ink:89)
|
||||
[96m foreign float4 :: (float, float2, float) -> float4; (test/wrong_type_for_function.ink:90)
|
||||
[96m foreign float4 :: (float, float2, float) -> float4; (test/wrong_type_for_function.ink:90)
|
||||
[96m foreign float4 :: (float, float, float2) -> float4; (test/wrong_type_for_function.ink:91)
|
||||
[96m foreign float4 :: (float, float, float2) -> float4; (test/wrong_type_for_function.ink:91)
|
||||
[96m foreign float4 :: (float3, float) -> float4; (test/wrong_type_for_function.ink:92)
|
||||
[96m foreign float4 :: (float3, float) -> float4; (test/wrong_type_for_function.ink:92)
|
||||
[96m foreign float4 :: (float, float3) -> float4; (test/wrong_type_for_function.ink:93)
|
||||
[96m foreign float4 :: (float, float3) -> float4; (test/wrong_type_for_function.ink:93)
|
||||
[96m foreign float4 :: (float) -> float4; (test/wrong_type_for_function.ink:94)
|
||||
[96m foreign float4 :: (float) -> float4; (test/wrong_type_for_function.ink:94)
|
||||
|
||||
[36m[37m[1;37mtest/wrong_type_for_function.ink:11,24: [31merror: [37mType mismatch. Expected float got float2
|
||||
[96m found:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
test/assign_arithmetic_expression.ink semant
|
||||
test/basic_property_and_return_value.ink semant
|
||||
test/complicated_computation.ink semant
|
||||
@@ -11,6 +12,7 @@ test/function_call_out_of_order_declaration.ink semant
|
||||
test/function_call_return.ink semant
|
||||
test/functions_with_same_name.ink semant
|
||||
test/function_with_int_return.ink semant
|
||||
test/if_cond_assign.ink semant
|
||||
test/inferred_types.ink semant
|
||||
test/multiple_functions.ink semant
|
||||
test/multiple_semicolons_everywhere.ink semant
|
||||
|
||||
Reference in New Issue
Block a user