reader/wgsl: Add source info to CallStatement

We were not printing source information for errors involving call
statements.

Change-Id: I576b4d095162333d4392d6be590e827a49918d3d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58520
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
James Price 2021-07-18 14:45:24 +00:00 committed by Tint LUCI CQ
parent a01bb4c984
commit 76feb6b626
2 changed files with 10 additions and 5 deletions

View File

@ -2109,7 +2109,7 @@ Maybe<ast::CallStatement*> ParserImpl::func_call_stmt() {
return Failure::kErrored;
return create<ast::CallStatement>(
Source{}, create<ast::CallExpression>(
source, create<ast::CallExpression>(
source,
create<ast::IdentifierExpression>(
source, builder_.Symbols().Register(name)),

View File

@ -28,6 +28,11 @@ TEST_F(ParserImplTest, Statement_Call) {
EXPECT_TRUE(e.matched);
EXPECT_FALSE(e.errored);
EXPECT_EQ(e->source().range.begin.line, 1u);
EXPECT_EQ(e->source().range.begin.column, 1u);
EXPECT_EQ(e->source().range.end.line, 1u);
EXPECT_EQ(e->source().range.end.column, 2u);
ASSERT_TRUE(e->Is<ast::CallStatement>());
auto* c = e->As<ast::CallStatement>()->expr();