Ifdefs, moved semantic to check, fixed error reporting for builtins
This commit is contained in:
@@ -7,15 +7,15 @@
|
||||
[96m result : float4 = float4(1.0, foo * res, 0.0, 1.0);
|
||||
^
|
||||
[97m Possible overloads:
|
||||
[96m float4 :: (float, float, float, float); (test/wrong_multiply.ink:0)
|
||||
[96m float4 :: (float2, float2); (test/wrong_multiply.ink:0)
|
||||
[96m float4 :: (float2, float, float); (test/wrong_multiply.ink:0)
|
||||
[96m float4 :: (float, float2, float); (test/wrong_multiply.ink:0)
|
||||
[96m float4 :: (float, float, float2); (test/wrong_multiply.ink:0)
|
||||
[96m float4 :: (float, float3); (test/wrong_multiply.ink:0)
|
||||
[96m float4 :: (float3, float); (test/wrong_multiply.ink:0)
|
||||
[96m float4 :: (float4); (test/wrong_multiply.ink:0)
|
||||
[96m float4 :: (float); (test/wrong_multiply.ink:0)
|
||||
[96m float4 :: (float, float, float, float)
|
||||
[96m float4 :: (float2, float2)
|
||||
[96m float4 :: (float2, float, float)
|
||||
[96m float4 :: (float, float2, float)
|
||||
[96m float4 :: (float, float, float2)
|
||||
[96m float4 :: (float, float3)
|
||||
[96m float4 :: (float3, float)
|
||||
[96m float4 :: (float4)
|
||||
[96m float4 :: (float)
|
||||
|
||||
[36m[37m[1;37mtest/wrong_multiply.ink:4,34: [31merror: [37mType mismatch. Expected float got float2
|
||||
[96m found:
|
||||
30
test/check/wrong_type_for_function.golden
Normal file
30
test/check/wrong_type_for_function.golden
Normal file
@@ -0,0 +1,30 @@
|
||||
[1;37mtest/wrong_type_for_function.ink:11,17: [31merror: [37mProcedure call did not match any of the possible overloads for 'float4'
|
||||
[96m found:
|
||||
color : float4 = float4(y, 1.0, 1.0, 1.0);
|
||||
^^^^^^
|
||||
|
||||
[97m While matching argument 1 in function call.
|
||||
[96m color : float4 = float4(y, 1.0, 1.0, 1.0);
|
||||
^
|
||||
[97m Possible overloads:
|
||||
[96m float4 :: (float, float, float, float)
|
||||
[96m float4 :: (float2, float2)
|
||||
[96m float4 :: (float2, float, float)
|
||||
[96m float4 :: (float, float2, float)
|
||||
[96m float4 :: (float, float, float2)
|
||||
[96m float4 :: (float, float3)
|
||||
[96m float4 :: (float3, float)
|
||||
[96m float4 :: (float4)
|
||||
[96m float4 :: (float)
|
||||
|
||||
[36m[37m[1;37mtest/wrong_type_for_function.ink:11,24: [31merror: [37mType mismatch. Expected float got float2
|
||||
[96m found:
|
||||
color : float4 = float4(y, 1.0, 1.0, 1.0);
|
||||
^
|
||||
expected:
|
||||
float
|
||||
|
||||
got:
|
||||
y : float2 = foo()
|
||||
|
||||
[36m[37m
|
||||
43
test/check_all.suite
Normal file
43
test/check_all.suite
Normal file
@@ -0,0 +1,43 @@
|
||||
test/assign_arithmetic_expression.ink check
|
||||
test/basic_property_and_return_value.ink check
|
||||
test/builtin_types.ink check
|
||||
test/complicated_computation.ink check
|
||||
test/constant_buffer.ink check
|
||||
test/empty_struct.ink check
|
||||
test/empty_vertex_main.ink check
|
||||
test/empty_vertex_main_with_position_parameter.ink check
|
||||
test/field_assignment.ink check
|
||||
test/for_i_loop.ink check
|
||||
test/function_call.ink check
|
||||
test/function_call_out_of_order_declaration.ink check
|
||||
test/function_call_return.ink check
|
||||
test/functions_with_same_name.ink check
|
||||
test/function_with_int_return.ink check
|
||||
test/if_cond_assign.ink check
|
||||
test/ifdefs.ink check
|
||||
test/if_def_block.ink check
|
||||
test/if_def_expression.ink check
|
||||
test/inferred_types.ink check
|
||||
test/multiple_functions.ink check
|
||||
test/multiple_semicolons_everywhere.ink check
|
||||
test/nested_if.ink check
|
||||
test/non_bool_cond.ink check
|
||||
test/pass_and_access_struct_fields_in_functions.ink check
|
||||
test/passthrough.ink check
|
||||
test/property_rename.ink check
|
||||
test/redeclared_variable.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/type_as_variable_name.ink check
|
||||
test/unary.ink check
|
||||
test/undeclared_function.ink check
|
||||
test/undeclared_symbol.ink check
|
||||
test/unknown_overload.ink check
|
||||
test/use_builtin_functions.ink check
|
||||
test/wrong_argument_count.ink check
|
||||
test/wrong_multiply.ink check
|
||||
test/wrong_type_for_function.ink check
|
||||
7
test/codegen/if_def_block.golden
Normal file
7
test/codegen/if_def_block.golden
Normal file
@@ -0,0 +1,7 @@
|
||||
void ps_main()
|
||||
{
|
||||
|
||||
float4 color = float4(1, 0, 0, 1);
|
||||
float f = 2.0f;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@ test/field_assignment.ink codegen
|
||||
test/function_call.ink codegen
|
||||
test/function_call_out_of_order_declaration.ink codegen
|
||||
test/function_call_return.ink codegen
|
||||
test/ifdefs.ink codegen
|
||||
test/if_def_block.ink codegen
|
||||
test/if_def_expression.ink codegen
|
||||
test/inferred_types.ink codegen
|
||||
test/meta_block.ink codegen
|
||||
test/multiple_functions.ink codegen
|
||||
|
||||
@@ -11,6 +11,9 @@ test/function_call.ink compile
|
||||
test/function_call_out_of_order_declaration.ink compile
|
||||
test/function_call_return.ink compile
|
||||
test/functions_with_same_name.ink compile
|
||||
test/ifdefs.ink compile
|
||||
test/if_def_block.ink compile
|
||||
test/if_def_expression.ink compile
|
||||
test/inferred_types.ink compile
|
||||
test/meta_block.ink compile
|
||||
test/multiple_functions.ink compile
|
||||
|
||||
11
test/if_def_block.ink
Normal file
11
test/if_def_block.ink
Normal file
@@ -0,0 +1,11 @@
|
||||
#add_define Alpha
|
||||
|
||||
pixel main :: () {
|
||||
#if Env.Alpha {
|
||||
alpha_color := float4(1, 0, 0, 1);
|
||||
f := 2.0;
|
||||
} else {
|
||||
color := float3(0, 0, 0);
|
||||
g := 5.0;
|
||||
}
|
||||
}
|
||||
13
test/if_def_expression.ink
Normal file
13
test/if_def_expression.ink
Normal file
@@ -0,0 +1,13 @@
|
||||
//#add_define PS5
|
||||
#add_define XSX
|
||||
//#add_define Switch2
|
||||
|
||||
#if (Env.PS5 && Env.XSX) || Env.Switch2 {
|
||||
vertex console_main :: () {
|
||||
|
||||
}
|
||||
} else {
|
||||
vertex windows_main :: () {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,17 @@
|
||||
#if Defines.Skinning {
|
||||
vertex main :: () {
|
||||
// Stub
|
||||
//#add_define Skinning
|
||||
#add_define UV
|
||||
|
||||
|
||||
#if Env.Skinning {
|
||||
vertex skinning_main :: () {
|
||||
x : float = 5.0;
|
||||
}
|
||||
} else #if Env.UV {
|
||||
vertex texture_mapping_main :: () {
|
||||
x : float2 = float2(2.0, 2.0);
|
||||
}
|
||||
}
|
||||
|
||||
pixel main :: () {
|
||||
|
||||
}
|
||||
|
||||
53
test/lex/if_def_block.golden
Normal file
53
test/lex/if_def_block.golden
Normal file
@@ -0,0 +1,53 @@
|
||||
{kind = TOKEN_PIXEL; ; index = 21 ; length = 5 line = 3 ; column = 0 ; value ='pixel'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 27 ; length = 4 line = 3 ; column = 6 ; value ='main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 32 ; length = 2 line = 3 ; column = 11 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 35 ; length = 1 line = 3 ; column = 14 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 36 ; length = 1 line = 3 ; column = 15 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 38 ; length = 1 line = 3 ; column = 17 ; value ='{'; }
|
||||
{kind = TOKEN_DIRECTIVE; ; index = 42 ; length = 2 line = 4 ; column = 0 ; value ='if'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 45 ; length = 3 line = 4 ; column = 3 ; value ='Env'; }
|
||||
{kind = TOKEN_DOT; ; index = 48 ; length = 1 line = 4 ; column = 6 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 49 ; length = 5 line = 4 ; column = 7 ; value ='Alpha'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 55 ; length = 1 line = 4 ; column = 13 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 59 ; length = 11 line = 5 ; column = 0 ; value ='alpha_color'; }
|
||||
{kind = TOKEN_COLON; ; index = 71 ; length = 1 line = 5 ; column = 12 ; value =':'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 72 ; length = 1 line = 5 ; column = 13 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 74 ; length = 6 line = 5 ; column = 15 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 80 ; length = 1 line = 5 ; column = 21 ; value ='('; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 81 ; length = 1 line = 5 ; column = 22 ; value ='1'; }
|
||||
{kind = TOKEN_COMMA; ; index = 82 ; length = 1 line = 5 ; column = 23 ; value =','; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 84 ; length = 1 line = 5 ; column = 25 ; value ='0'; }
|
||||
{kind = TOKEN_COMMA; ; index = 85 ; length = 1 line = 5 ; column = 26 ; value =','; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 87 ; length = 1 line = 5 ; column = 28 ; value ='0'; }
|
||||
{kind = TOKEN_COMMA; ; index = 88 ; length = 1 line = 5 ; column = 29 ; value =','; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 90 ; length = 1 line = 5 ; column = 31 ; value ='1'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 91 ; length = 1 line = 5 ; column = 32 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 92 ; length = 1 line = 5 ; column = 33 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 96 ; length = 1 line = 6 ; column = 0 ; value ='f'; }
|
||||
{kind = TOKEN_COLON; ; index = 98 ; length = 1 line = 6 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 99 ; length = 1 line = 6 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 101 ; length = 3 line = 6 ; column = 5 ; value ='2'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 104 ; length = 1 line = 6 ; column = 8 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 107 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_ELSE; ; index = 109 ; length = 4 line = 7 ; column = 2 ; value ='else'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 114 ; length = 1 line = 7 ; column = 7 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 118 ; length = 5 line = 8 ; column = 0 ; value ='color'; }
|
||||
{kind = TOKEN_COLON; ; index = 124 ; length = 1 line = 8 ; column = 6 ; value =':'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 125 ; length = 1 line = 8 ; column = 7 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 127 ; length = 6 line = 8 ; column = 9 ; value ='float3'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 133 ; length = 1 line = 8 ; column = 15 ; value ='('; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 134 ; length = 1 line = 8 ; column = 16 ; value ='0'; }
|
||||
{kind = TOKEN_COMMA; ; index = 135 ; length = 1 line = 8 ; column = 17 ; value =','; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 137 ; length = 1 line = 8 ; column = 19 ; value ='0'; }
|
||||
{kind = TOKEN_COMMA; ; index = 138 ; length = 1 line = 8 ; column = 20 ; value =','; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 140 ; length = 1 line = 8 ; column = 22 ; value ='0'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 141 ; length = 1 line = 8 ; column = 23 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 142 ; length = 1 line = 8 ; column = 24 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 146 ; length = 1 line = 9 ; column = 0 ; value ='g'; }
|
||||
{kind = TOKEN_COLON; ; index = 148 ; length = 1 line = 9 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 149 ; length = 1 line = 9 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 151 ; length = 3 line = 9 ; column = 5 ; value ='5'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 154 ; length = 1 line = 9 ; column = 8 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 157 ; length = 1 line = 10 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 160 ; length = 1 line = 11 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 163 ; length = 0 line = 12 ; column = 0 ; value =''; }
|
||||
34
test/lex/if_def_expression.golden
Normal file
34
test/lex/if_def_expression.golden
Normal file
@@ -0,0 +1,34 @@
|
||||
{kind = TOKEN_DIRECTIVE; ; index = 62 ; length = 2 line = 5 ; column = 0 ; value ='if'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 65 ; length = 1 line = 5 ; column = 3 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 66 ; length = 3 line = 5 ; column = 4 ; value ='Env'; }
|
||||
{kind = TOKEN_DOT; ; index = 69 ; length = 1 line = 5 ; column = 7 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 70 ; length = 3 line = 5 ; column = 8 ; value ='PS5'; }
|
||||
{kind = TOKEN_LOGICALAND; ; index = 74 ; length = 2 line = 5 ; column = 12 ; value ='&&'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 77 ; length = 3 line = 5 ; column = 15 ; value ='Env'; }
|
||||
{kind = TOKEN_DOT; ; index = 80 ; length = 1 line = 5 ; column = 18 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 81 ; length = 3 line = 5 ; column = 19 ; value ='XSX'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 84 ; length = 1 line = 5 ; column = 22 ; value =')'; }
|
||||
{kind = TOKEN_LOGICALOR; ; index = 86 ; length = 2 line = 5 ; column = 24 ; value ='||'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 89 ; length = 3 line = 5 ; column = 27 ; value ='Env'; }
|
||||
{kind = TOKEN_DOT; ; index = 92 ; length = 1 line = 5 ; column = 30 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 93 ; length = 7 line = 5 ; column = 31 ; value ='Switch2'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 101 ; length = 1 line = 5 ; column = 39 ; value ='{'; }
|
||||
{kind = TOKEN_VERTEX; ; index = 105 ; length = 6 line = 6 ; column = 0 ; value ='vertex'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 112 ; length = 12 line = 6 ; column = 7 ; value ='console_main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 125 ; length = 2 line = 6 ; column = 20 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 128 ; length = 1 line = 6 ; column = 23 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 129 ; length = 1 line = 6 ; column = 24 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 131 ; length = 1 line = 6 ; column = 26 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 137 ; length = 1 line = 8 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 140 ; length = 1 line = 9 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_ELSE; ; index = 142 ; length = 4 line = 9 ; column = 2 ; value ='else'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 147 ; length = 1 line = 9 ; column = 7 ; value ='{'; }
|
||||
{kind = TOKEN_VERTEX; ; index = 151 ; length = 6 line = 10 ; column = 0 ; value ='vertex'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 158 ; length = 12 line = 10 ; column = 7 ; value ='windows_main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 171 ; length = 2 line = 10 ; column = 20 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 174 ; length = 1 line = 10 ; column = 23 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 175 ; length = 1 line = 10 ; column = 24 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 177 ; length = 1 line = 10 ; column = 26 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 183 ; length = 1 line = 12 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 186 ; length = 1 line = 13 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 189 ; length = 0 line = 14 ; column = 0 ; value =''; }
|
||||
52
test/lex/ifdefs.golden
Normal file
52
test/lex/ifdefs.golden
Normal file
@@ -0,0 +1,52 @@
|
||||
{kind = TOKEN_DIRECTIVE; ; index = 45 ; length = 2 line = 5 ; column = 0 ; value ='if'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 48 ; length = 3 line = 5 ; column = 3 ; value ='Env'; }
|
||||
{kind = TOKEN_DOT; ; index = 51 ; length = 1 line = 5 ; column = 6 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 52 ; length = 8 line = 5 ; column = 7 ; value ='Skinning'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 61 ; length = 1 line = 5 ; column = 16 ; value ='{'; }
|
||||
{kind = TOKEN_VERTEX; ; index = 65 ; length = 6 line = 6 ; column = 0 ; value ='vertex'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 72 ; length = 13 line = 6 ; column = 7 ; value ='skinning_main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 86 ; length = 2 line = 6 ; column = 21 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 89 ; length = 1 line = 6 ; column = 24 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 90 ; length = 1 line = 6 ; column = 25 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 92 ; length = 1 line = 6 ; column = 27 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 97 ; length = 1 line = 7 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_COLON; ; index = 99 ; length = 1 line = 7 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 101 ; length = 5 line = 7 ; column = 4 ; value ='float'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 107 ; length = 1 line = 7 ; column = 10 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 109 ; length = 3 line = 7 ; column = 12 ; value ='5'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 112 ; length = 1 line = 7 ; column = 15 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 116 ; length = 1 line = 8 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 119 ; length = 1 line = 9 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_ELSE; ; index = 121 ; length = 4 line = 9 ; column = 2 ; value ='else'; }
|
||||
{kind = TOKEN_DIRECTIVE; ; index = 127 ; length = 2 line = 9 ; column = 7 ; value ='if'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 130 ; length = 3 line = 9 ; column = 10 ; value ='Env'; }
|
||||
{kind = TOKEN_DOT; ; index = 133 ; length = 1 line = 9 ; column = 13 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 134 ; length = 2 line = 9 ; column = 14 ; value ='UV'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 137 ; length = 1 line = 9 ; column = 17 ; value ='{'; }
|
||||
{kind = TOKEN_VERTEX; ; index = 141 ; length = 6 line = 10 ; column = 0 ; value ='vertex'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 148 ; length = 20 line = 10 ; column = 7 ; value ='texture_mapping_main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 169 ; length = 2 line = 10 ; column = 28 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 172 ; length = 1 line = 10 ; column = 31 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 173 ; length = 1 line = 10 ; column = 32 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 175 ; length = 1 line = 10 ; column = 34 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 180 ; length = 1 line = 11 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_COLON; ; index = 182 ; length = 1 line = 11 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 184 ; length = 6 line = 11 ; column = 4 ; value ='float2'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 191 ; length = 1 line = 11 ; column = 11 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 193 ; length = 6 line = 11 ; column = 13 ; value ='float2'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 199 ; length = 1 line = 11 ; column = 19 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 200 ; length = 3 line = 11 ; column = 20 ; value ='2'; }
|
||||
{kind = TOKEN_COMMA; ; index = 203 ; length = 1 line = 11 ; column = 23 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 205 ; length = 3 line = 11 ; column = 25 ; value ='2'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 208 ; length = 1 line = 11 ; column = 28 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 209 ; length = 1 line = 11 ; column = 29 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 213 ; length = 1 line = 12 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 216 ; length = 1 line = 13 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_PIXEL; ; index = 221 ; length = 5 line = 15 ; column = 0 ; value ='pixel'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 227 ; length = 4 line = 15 ; column = 6 ; value ='main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 232 ; length = 2 line = 15 ; column = 11 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 235 ; length = 1 line = 15 ; column = 14 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 236 ; length = 1 line = 15 ; column = 15 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 238 ; length = 1 line = 15 ; column = 17 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 243 ; length = 1 line = 17 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 246 ; length = 0 line = 18 ; column = 0 ; value =''; }
|
||||
@@ -20,6 +20,9 @@ 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/ifdefs.ink lex
|
||||
test/if_def_block.ink lex
|
||||
test/if_def_expression.ink lex
|
||||
test/if_if_if.ink lex
|
||||
test/inferred_types.ink lex
|
||||
test/large_block.ink lex
|
||||
|
||||
8
test/parse/if_def_block.golden
Normal file
8
test/parse/if_def_block.golden
Normal file
@@ -0,0 +1,8 @@
|
||||
(program
|
||||
(fun pixel ps_main
|
||||
[]
|
||||
(#if Env.Alpha
|
||||
(:= alpha_color (float4 1 0 0 1))
|
||||
(:= f 2)
|
||||
(:= color (float3 0 0 0))
|
||||
(:= g 5))))
|
||||
6
test/parse/if_def_expression.golden
Normal file
6
test/parse/if_def_expression.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
(program
|
||||
(#if (|| (&& Env.PS5 Env.XSX) Env.Switch2)
|
||||
(fun vertex vs_console_main
|
||||
[])
|
||||
(fun vertex vs_windows_main
|
||||
[])))
|
||||
@@ -20,6 +20,9 @@ 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/ifdefs.ink parse
|
||||
test/if_def_block.ink parse
|
||||
test/if_def_expression.ink parse
|
||||
test/if_if_if.ink parse
|
||||
test/inferred_types.ink parse
|
||||
test/large_block.ink parse
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
[1;37mtest/wrong_type_for_function.ink:11,17: [31merror: [37mProcedure call did not match any of the possible overloads for 'float4'
|
||||
[96m found:
|
||||
color : float4 = float4(y, 1.0, 1.0, 1.0);
|
||||
^^^^^^
|
||||
|
||||
[97m While matching argument 1 in function call.
|
||||
[96m color : float4 = float4(y, 1.0, 1.0, 1.0);
|
||||
^
|
||||
[97m Possible overloads:
|
||||
[96m float4 :: (float, float, float, float); (test/wrong_type_for_function.ink:0)
|
||||
[96m float4 :: (float2, float2); (test/wrong_type_for_function.ink:0)
|
||||
[96m float4 :: (float2, float, float); (test/wrong_type_for_function.ink:0)
|
||||
[96m float4 :: (float, float2, float); (test/wrong_type_for_function.ink:0)
|
||||
[96m float4 :: (float, float, float2); (test/wrong_type_for_function.ink:0)
|
||||
[96m float4 :: (float, float3); (test/wrong_type_for_function.ink:0)
|
||||
[96m float4 :: (float3, float); (test/wrong_type_for_function.ink:0)
|
||||
[96m float4 :: (float4); (test/wrong_type_for_function.ink:0)
|
||||
[96m float4 :: (float); (test/wrong_type_for_function.ink:0)
|
||||
|
||||
[36m[37m[1;37mtest/wrong_type_for_function.ink:11,24: [31merror: [37mType mismatch. Expected float got float2
|
||||
[96m found:
|
||||
color : float4 = float4(y, 1.0, 1.0, 1.0);
|
||||
^
|
||||
expected:
|
||||
float
|
||||
|
||||
got:
|
||||
y : float2 = foo()
|
||||
|
||||
[36m[37m
|
||||
@@ -1,40 +0,0 @@
|
||||
test/assign_arithmetic_expression.ink semant
|
||||
test/basic_property_and_return_value.ink semant
|
||||
test/builtin_types.ink semant
|
||||
test/complicated_computation.ink semant
|
||||
test/constant_buffer.ink semant
|
||||
test/empty_struct.ink semant
|
||||
test/empty_vertex_main.ink semant
|
||||
test/empty_vertex_main_with_position_parameter.ink semant
|
||||
test/field_assignment.ink semant
|
||||
test/for_i_loop.ink semant
|
||||
test/function_call.ink semant
|
||||
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
|
||||
test/nested_if.ink semant
|
||||
test/non_bool_cond.ink semant
|
||||
test/pass_and_access_struct_fields_in_functions.ink semant
|
||||
test/passthrough.ink semant
|
||||
test/property_rename.ink semant
|
||||
test/redeclared_variable.ink semant
|
||||
test/simple_else_if.ink semant
|
||||
test/simple_if_else.ink semant
|
||||
test/simple_if.ink semant
|
||||
test/simple_struct_access.ink semant
|
||||
test/struct_access_primitive_type.ink semant
|
||||
test/struct_within_struct.ink semant
|
||||
test/type_as_variable_name.ink semant
|
||||
test/unary.ink semant
|
||||
test/undeclared_function.ink semant
|
||||
test/undeclared_symbol.ink semant
|
||||
test/unknown_overload.ink semant
|
||||
test/use_builtin_functions.ink semant
|
||||
test/wrong_argument_count.ink semant
|
||||
test/wrong_multiply.ink semant
|
||||
test/wrong_type_for_function.ink semant
|
||||
Reference in New Issue
Block a user