9using namespace shader::parser;
10using namespace shader;
28 auto [
output, _, error] = process_test_string(input);
29 EXPECT_EQ(error,
"Call to function is ambiguous. Specify namespace to remove ambiguity.");
34int func(int a) { return 0; }
44int A_func(int a) { return 0; }
52 auto [
output, _, error] = process_test_string(input);
63 return B::func(int a);
76struct A_S { int _pad;};
78 A_S A_S_ctor_() {A_S r;r._pad=0;return r;}
93 auto [
output, _, error] = process_test_string(input);
118 return A_B_func(int a);
122 auto [
output, _, error] = process_test_string(input);
140void A_B_b() { A_a(); }
142void A_f() { A_B_b(); }
145 auto [
output, _, error] = process_test_string(input);
170 auto [
output, _, error] = process_test_string(input);
197 auto [
output, _, error] = process_test_string(input);
219struct A_B_S { int _pad;};
221 A_B_S A_B_S_ctor_() {A_B_S r;r._pad=0;return r;}
229 auto [
output, _, error] = process_test_string(input);
237 auto [
output, _, error] = process_test_string(input);
238 EXPECT_EQ(error,
"The `using` keyword is not allowed in global scope.");
246 auto [
output, _, error] = process_test_string(input);
248 "Unsupported `using namespace`. "
249 "Add individual `using` directives for each needed symbol.");
257 auto [
output, _, error] = process_test_string(input);
259 "The `using` keyword is only allowed in namespace scope to make visible symbols "
260 "from the same namespace declared in another scope, potentially from another "
269 auto [
output, _, error] = process_test_string(input);
271 "The `using` keyword is only allowed in namespace scope to make visible symbols "
272 "from the same namespace declared in another scope, potentially from another "
280template<typename T> T read(T a)
284template float read<float>(float);
285float write(float a){ return a; }
291float NS_read(float a)
296float NS_write(float a){ return a; }
299 auto [
output, _, error] = process_test_string(input);
308 static S static_method(S s) {
311 S other_method(int s) {
328NS_S NS_S_static_method(NS_S s);
329NS_S _other_method(_ref(NS_S ,this_), int s);
332 NS_S NS_S_ctor_() {NS_S r;r._pad=0;return r;}
333 NS_S NS_S_static_method(NS_S s) {
336 NS_S _other_method(_ref(NS_S ,this_), int s) {
343 auto [
output, _, error] = process_test_string(input);
351template<> Type a<Type>() {}
360 auto [
output, _, error] = process_test_string(input);
370 static int D() { return B::C().R(); }
371 static int E() { return C().R(); }
372 static B C() { return B(0); }
373 int R() { return R(); }
375B fn() { return B::C(); }
391int _R(_ref(NS_B ,this_));
394 NS_B NS_B_ctor_() {NS_B r;r.i=0;return r;}
396 int NS_B_D() { return _R(NS_B_C()); }
397 int NS_B_E() { return _R(NS_B_C()); }
398 NS_B NS_B_C() { return NS_B(0); }
399 int _R(_ref(NS_B ,this_)) { return _R(this_); }
401NS_B NS_fn() { return NS_B_C(); }
404 auto [
output, _, error] = process_test_string(input);
416namespace A { struct T {}; }
427 auto [
output, _, error] = process_test_string(input, Language::BSL);
#define EXPECT_EQ(result, expect)
TEST(shader_tool, ExpressionParser)
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)