From 76feb6b6261655a98a32aebe60bf2a8355e96739 Mon Sep 17 00:00:00 2001 From: James Price Date: Sun, 18 Jul 2021 14:45:24 +0000 Subject: [PATCH] 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 Commit-Queue: Ben Clayton Kokoro: Kokoro Reviewed-by: Ben Clayton --- src/reader/wgsl/parser_impl.cc | 10 +++++----- src/reader/wgsl/parser_impl_call_stmt_test.cc | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc index d8209a7b14..3d2c8e3d69 100644 --- a/src/reader/wgsl/parser_impl.cc +++ b/src/reader/wgsl/parser_impl.cc @@ -2109,11 +2109,11 @@ Maybe ParserImpl::func_call_stmt() { return Failure::kErrored; return create( - Source{}, create( - source, - create( - source, builder_.Symbols().Register(name)), - std::move(params.value))); + source, create( + source, + create( + source, builder_.Symbols().Register(name)), + std::move(params.value))); } // break_stmt diff --git a/src/reader/wgsl/parser_impl_call_stmt_test.cc b/src/reader/wgsl/parser_impl_call_stmt_test.cc index 28dc2c813d..8d4429ca54 100644 --- a/src/reader/wgsl/parser_impl_call_stmt_test.cc +++ b/src/reader/wgsl/parser_impl_call_stmt_test.cc @@ -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()); auto* c = e->As()->expr();