validation: validate function call pointer parameter

Each argument of a function call of pointer type must be one of:
- An address-of expression of a variable identifier expression
- A function parameter
Also added source location to duplicate struct member name unittest

Bug: tint:983
Change-Id: Ic5ab010b2ed76207a1d8d3ef9f66140ea95f7e72
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58480
Auto-Submit: Sarah Mashayekhi <sarahmashay@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
This commit is contained in:
Sarah
2021-07-20 18:14:02 +00:00
committed by Tint LUCI CQ
parent 6d27f23451
commit 3d441d48bb
6 changed files with 249 additions and 93 deletions

View File

@@ -79,35 +79,6 @@ fn f() {
EXPECT_EQ(expect, str(got));
}
TEST_F(InlinePointerLetsTest, Param) {
auto* src = R"(
fn x(p : ptr<function, i32>) -> i32 {
return *p;
}
fn f() {
var v : i32;
let p : ptr<function, i32> = &v;
var r : i32 = x(p);
}
)";
auto* expect = R"(
fn x(p : ptr<function, i32>) -> i32 {
return *(p);
}
fn f() {
var v : i32;
var r : i32 = x(&(v));
}
)";
auto got = Run<InlinePointerLets>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(InlinePointerLetsTest, SavedVars) {
auto* src = R"(
struct S {