Remove tint::Source(size_t, size_t) constructor This was a temporary overload to break up the changes into smaller chunks. Change all call sites to use one of the other constructors. Bug: tint:282 Change-Id: I500fe9700d22f72312827808caa22f7feef7b294 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31440 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: dan sinclair <dsinclair@chromium.org>
diff --git a/src/ast/array_accessor_expression_test.cc b/src/ast/array_accessor_expression_test.cc index 1470bc0..a43b6b2 100644 --- a/src/ast/array_accessor_expression_test.cc +++ b/src/ast/array_accessor_expression_test.cc
@@ -38,7 +38,8 @@ auto ary = std::make_unique<IdentifierExpression>("ary"); auto idx = std::make_unique<IdentifierExpression>("idx"); - ArrayAccessorExpression exp(Source{20, 2}, std::move(ary), std::move(idx)); + ArrayAccessorExpression exp(Source{Source::Location{20, 2}}, std::move(ary), + std::move(idx)); auto src = exp.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/assignment_statement_test.cc b/src/ast/assignment_statement_test.cc index b157020..681b41b 100644 --- a/src/ast/assignment_statement_test.cc +++ b/src/ast/assignment_statement_test.cc
@@ -39,7 +39,8 @@ auto lhs = std::make_unique<ast::IdentifierExpression>("lhs"); auto rhs = std::make_unique<ast::IdentifierExpression>("rhs"); - AssignmentStatement stmt(Source{20, 2}, std::move(lhs), std::move(rhs)); + AssignmentStatement stmt(Source{Source::Location{20, 2}}, std::move(lhs), + std::move(rhs)); auto src = stmt.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/binary_expression_test.cc b/src/ast/binary_expression_test.cc index 9a7510d..9140b7e 100644 --- a/src/ast/binary_expression_test.cc +++ b/src/ast/binary_expression_test.cc
@@ -42,8 +42,8 @@ auto lhs = std::make_unique<IdentifierExpression>("lhs"); auto rhs = std::make_unique<IdentifierExpression>("rhs"); - BinaryExpression r(Source{20, 2}, BinaryOp::kEqual, std::move(lhs), - std::move(rhs)); + BinaryExpression r(Source{Source::Location{20, 2}}, BinaryOp::kEqual, + std::move(lhs), std::move(rhs)); auto src = r.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/bitcast_expression_test.cc b/src/ast/bitcast_expression_test.cc index 7ef635a..fbc6059 100644 --- a/src/ast/bitcast_expression_test.cc +++ b/src/ast/bitcast_expression_test.cc
@@ -39,7 +39,7 @@ type::F32Type f32; auto expr = std::make_unique<IdentifierExpression>("expr"); - BitcastExpression exp(Source{20, 2}, &f32, std::move(expr)); + BitcastExpression exp(Source{Source::Location{20, 2}}, &f32, std::move(expr)); auto src = exp.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/block_statement_test.cc b/src/ast/block_statement_test.cc index ac3f65b..d2276bc 100644 --- a/src/ast/block_statement_test.cc +++ b/src/ast/block_statement_test.cc
@@ -60,7 +60,7 @@ } TEST_F(BlockStatementTest, Creation_WithSource) { - BlockStatement b(Source{20, 2}); + BlockStatement b(Source{Source::Location{20, 2}}); auto src = b.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/break_statement_test.cc b/src/ast/break_statement_test.cc index 485030d..fda7552 100644 --- a/src/ast/break_statement_test.cc +++ b/src/ast/break_statement_test.cc
@@ -23,7 +23,7 @@ using BreakStatementTest = testing::Test; TEST_F(BreakStatementTest, Creation_WithSource) { - BreakStatement stmt(Source{20, 2}); + BreakStatement stmt(Source{Source::Location{20, 2}}); auto src = stmt.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/call_expression_test.cc b/src/ast/call_expression_test.cc index 120100f..89e4872 100644 --- a/src/ast/call_expression_test.cc +++ b/src/ast/call_expression_test.cc
@@ -44,7 +44,7 @@ TEST_F(CallExpressionTest, Creation_WithSource) { auto func = std::make_unique<IdentifierExpression>("func"); - CallExpression stmt(Source{20, 2}, std::move(func), {}); + CallExpression stmt(Source{Source::Location{20, 2}}, std::move(func), {}); auto src = stmt.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/case_statement_test.cc b/src/ast/case_statement_test.cc index 82f6868..85194fd 100644 --- a/src/ast/case_statement_test.cc +++ b/src/ast/case_statement_test.cc
@@ -74,7 +74,8 @@ auto body = std::make_unique<BlockStatement>(); body->append(std::make_unique<DiscardStatement>()); - CaseStatement c(Source{20, 2}, std::move(b), std::move(body)); + CaseStatement c(Source{Source::Location{20, 2}}, std::move(b), + std::move(body)); auto src = c.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/continue_statement_test.cc b/src/ast/continue_statement_test.cc index fa5ac43..bd8c9b6 100644 --- a/src/ast/continue_statement_test.cc +++ b/src/ast/continue_statement_test.cc
@@ -23,7 +23,7 @@ using ContinueStatementTest = testing::Test; TEST_F(ContinueStatementTest, Creation_WithSource) { - ContinueStatement stmt(Source{20, 2}); + ContinueStatement stmt(Source{Source::Location{20, 2}}); auto src = stmt.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/decorated_variable_test.cc b/src/ast/decorated_variable_test.cc index 6b035ad..6023df8 100644 --- a/src/ast/decorated_variable_test.cc +++ b/src/ast/decorated_variable_test.cc
@@ -45,7 +45,7 @@ } TEST_F(DecoratedVariableTest, CreationWithSource) { - Source s{27, 4}; + Source s{Source::Location{27, 4}}; type::F32Type t; auto var = std::make_unique<Variable>(s, "i", StorageClass::kPrivate, &t); DecoratedVariable dv(std::move(var));
diff --git a/src/ast/discard_statement_test.cc b/src/ast/discard_statement_test.cc index c6bcd49..34cc13c 100644 --- a/src/ast/discard_statement_test.cc +++ b/src/ast/discard_statement_test.cc
@@ -31,7 +31,7 @@ } TEST_F(DiscardStatementTest, Creation_WithSource) { - DiscardStatement stmt(Source{20, 2}); + DiscardStatement stmt(Source{Source::Location{20, 2}}); EXPECT_EQ(stmt.line(), 20u); EXPECT_EQ(stmt.column(), 2u); }
diff --git a/src/ast/else_statement_test.cc b/src/ast/else_statement_test.cc index a230c2a..6235a9d 100644 --- a/src/ast/else_statement_test.cc +++ b/src/ast/else_statement_test.cc
@@ -44,7 +44,8 @@ } TEST_F(ElseStatementTest, Creation_WithSource) { - ElseStatement e(Source{20, 2}, std::make_unique<BlockStatement>()); + ElseStatement e(Source{Source::Location{20, 2}}, + std::make_unique<BlockStatement>()); auto src = e.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/fallthrough_statement_test.cc b/src/ast/fallthrough_statement_test.cc index adbb558..bae0384 100644 --- a/src/ast/fallthrough_statement_test.cc +++ b/src/ast/fallthrough_statement_test.cc
@@ -29,7 +29,7 @@ } TEST_F(FallthroughStatementTest, Creation_WithSource) { - FallthroughStatement stmt(Source{20, 2}); + FallthroughStatement stmt(Source{Source::Location{20, 2}}); auto src = stmt.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/function_test.cc b/src/ast/function_test.cc index 0dbfbef..ed88269 100644 --- a/src/ast/function_test.cc +++ b/src/ast/function_test.cc
@@ -56,7 +56,8 @@ params.push_back( std::make_unique<Variable>("var", StorageClass::kNone, &i32)); - Function f(Source{20, 2}, "func", std::move(params), &void_type); + Function f(Source{Source::Location{20, 2}}, "func", std::move(params), + &void_type); auto src = f.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/identifier_expression_test.cc b/src/ast/identifier_expression_test.cc index fbb5dd7..95e0db2 100644 --- a/src/ast/identifier_expression_test.cc +++ b/src/ast/identifier_expression_test.cc
@@ -28,7 +28,7 @@ } TEST_F(IdentifierExpressionTest, Creation_WithSource) { - IdentifierExpression i(Source{20, 2}, "ident"); + IdentifierExpression i(Source{Source::Location{20, 2}}, "ident"); EXPECT_EQ(i.name(), "ident"); auto src = i.source();
diff --git a/src/ast/if_statement_test.cc b/src/ast/if_statement_test.cc index 779e889..2e3db87 100644 --- a/src/ast/if_statement_test.cc +++ b/src/ast/if_statement_test.cc
@@ -43,7 +43,7 @@ auto body = std::make_unique<ast::BlockStatement>(); body->append(std::make_unique<DiscardStatement>()); - IfStatement stmt(Source{20, 2}, std::move(cond), std::move(body)); + IfStatement stmt(Source{Source::Location{20, 2}}, std::move(cond), std::move(body)); auto src = stmt.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/loop_statement_test.cc b/src/ast/loop_statement_test.cc index cf1dc50..b63aaec 100644 --- a/src/ast/loop_statement_test.cc +++ b/src/ast/loop_statement_test.cc
@@ -50,7 +50,8 @@ auto continuing = std::make_unique<BlockStatement>(); continuing->append(std::make_unique<DiscardStatement>()); - LoopStatement l(Source{20, 2}, std::move(body), std::move(continuing)); + LoopStatement l(Source{Source::Location{20, 2}}, std::move(body), + std::move(continuing)); auto src = l.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/member_accessor_expression_test.cc b/src/ast/member_accessor_expression_test.cc index 66ac1f7..aefb618 100644 --- a/src/ast/member_accessor_expression_test.cc +++ b/src/ast/member_accessor_expression_test.cc
@@ -41,7 +41,8 @@ auto str = std::make_unique<IdentifierExpression>("structure"); auto mem = std::make_unique<IdentifierExpression>("member"); - MemberAccessorExpression stmt(Source{20, 2}, std::move(str), std::move(mem)); + MemberAccessorExpression stmt(Source{Source::Location{20, 2}}, std::move(str), + std::move(mem)); auto src = stmt.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/return_statement_test.cc b/src/ast/return_statement_test.cc index 76d9e2a..7ff2621 100644 --- a/src/ast/return_statement_test.cc +++ b/src/ast/return_statement_test.cc
@@ -34,7 +34,7 @@ } TEST_F(ReturnStatementTest, Creation_WithSource) { - ReturnStatement r(Source{20, 2}); + ReturnStatement r(Source{Source::Location{20, 2}}); auto src = r.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/scalar_constructor_expression_test.cc b/src/ast/scalar_constructor_expression_test.cc index 28f7012..3dc4ea5 100644 --- a/src/ast/scalar_constructor_expression_test.cc +++ b/src/ast/scalar_constructor_expression_test.cc
@@ -35,7 +35,7 @@ TEST_F(ScalarConstructorExpressionTest, Creation_WithSource) { ast::type::BoolType bool_type; auto b = std::make_unique<BoolLiteral>(&bool_type, true); - ScalarConstructorExpression c(Source{20, 2}, std::move(b)); + ScalarConstructorExpression c(Source{Source::Location{20, 2}}, std::move(b)); auto src = c.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/struct_member_test.cc b/src/ast/struct_member_test.cc index c73a8a8..3fcade3 100644 --- a/src/ast/struct_member_test.cc +++ b/src/ast/struct_member_test.cc
@@ -43,7 +43,7 @@ TEST_F(StructMemberTest, CreationWithSource) { type::I32Type i32; - Source s{27, 4}; + Source s{Source::Location{27, 4}}; StructMember st{s, "a", &i32, {}}; EXPECT_EQ(st.name(), "a");
diff --git a/src/ast/struct_test.cc b/src/ast/struct_test.cc index 0569001..6bea6a1 100644 --- a/src/ast/struct_test.cc +++ b/src/ast/struct_test.cc
@@ -70,7 +70,8 @@ StructDecorationList decos; decos.push_back(StructDecoration::kBlock); - Struct s{Source{27, 4}, std::move(decos), std::move(members)}; + Struct s{Source{Source::Location{27, 4}}, std::move(decos), + std::move(members)}; EXPECT_EQ(s.members().size(), 1u); ASSERT_EQ(s.decorations().size(), 1u); EXPECT_EQ(s.decorations()[0], StructDecoration::kBlock);
diff --git a/src/ast/switch_statement_test.cc b/src/ast/switch_statement_test.cc index dc5b5b0..b37c07a 100644 --- a/src/ast/switch_statement_test.cc +++ b/src/ast/switch_statement_test.cc
@@ -51,7 +51,7 @@ TEST_F(SwitchStatementTest, Creation_WithSource) { auto ident = std::make_unique<IdentifierExpression>("ident"); - SwitchStatement stmt(Source{20, 2}, std::move(ident), CaseStatementList()); + SwitchStatement stmt(Source{Source::Location{20, 2}}, std::move(ident), CaseStatementList()); auto src = stmt.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/type_constructor_expression_test.cc b/src/ast/type_constructor_expression_test.cc index dfceda0..a65a343 100644 --- a/src/ast/type_constructor_expression_test.cc +++ b/src/ast/type_constructor_expression_test.cc
@@ -46,7 +46,8 @@ ExpressionList expr; expr.push_back(std::make_unique<IdentifierExpression>("expr")); - TypeConstructorExpression t(Source{20, 2}, &f32, std::move(expr)); + TypeConstructorExpression t(Source{Source::Location{20, 2}}, &f32, + std::move(expr)); auto src = t.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/unary_op_expression_test.cc b/src/ast/unary_op_expression_test.cc index 5b32af3..da018c0 100644 --- a/src/ast/unary_op_expression_test.cc +++ b/src/ast/unary_op_expression_test.cc
@@ -36,7 +36,8 @@ TEST_F(UnaryOpExpressionTest, Creation_WithSource) { auto ident = std::make_unique<IdentifierExpression>("ident"); - UnaryOpExpression u(Source{20, 2}, UnaryOp::kNot, std::move(ident)); + UnaryOpExpression u(Source{Source::Location{20, 2}}, UnaryOp::kNot, + std::move(ident)); auto src = u.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u);
diff --git a/src/ast/variable_decl_statement_test.cc b/src/ast/variable_decl_statement_test.cc index 61fcb07..60832d0 100644 --- a/src/ast/variable_decl_statement_test.cc +++ b/src/ast/variable_decl_statement_test.cc
@@ -37,7 +37,7 @@ type::F32Type f32; auto var = std::make_unique<Variable>("a", StorageClass::kNone, &f32); - VariableDeclStatement stmt(Source{20, 2}, std::move(var)); + VariableDeclStatement stmt(Source{Source::Location{20, 2}}, std::move(var)); auto src = stmt.source(); EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); @@ -71,7 +71,7 @@ type::F32Type f32; auto var = std::make_unique<Variable>("a", StorageClass::kNone, &f32); - VariableDeclStatement stmt(Source{20, 2}, std::move(var)); + VariableDeclStatement stmt(Source{Source::Location{20, 2}}, std::move(var)); std::ostringstream out; stmt.to_str(out, 2); EXPECT_EQ(out.str(), R"( VariableDeclStatement{
diff --git a/src/ast/variable_test.cc b/src/ast/variable_test.cc index fd0db76..e1c8085 100644 --- a/src/ast/variable_test.cc +++ b/src/ast/variable_test.cc
@@ -37,7 +37,7 @@ } TEST_F(VariableTest, CreationWithSource) { - Source s{27, 4}; + Source s{Source::Location{27, 4}}; type::F32Type t; Variable v(s, "i", StorageClass::kPrivate, &t); @@ -49,7 +49,7 @@ } TEST_F(VariableTest, CreationEmpty) { - Source s{27, 4}; + Source s{Source::Location{27, 4}}; Variable v; v.set_source(s); v.set_storage_class(StorageClass::kWorkgroup);
diff --git a/src/reader/spirv/parser_impl.cc b/src/reader/spirv/parser_impl.cc index af3d07d..108bd2a 100644 --- a/src/reader/spirv/parser_impl.cc +++ b/src/reader/spirv/parser_impl.cc
@@ -474,12 +474,12 @@ } void ParserImpl::RegisterLineNumbers() { - Source::Location instruction_number{0, 0}; + Source::Location instruction_number{}; // Has there been an OpLine since the last OpNoLine or start of the module? bool in_op_line_scope = false; // The source location provided by the most recent OpLine instruction. - Source::Location op_line_source{0, 0}; + Source::Location op_line_source{}; const bool run_on_debug_insts = true; module_->ForEachInst( [this, &in_op_line_scope, &op_line_source,
diff --git a/src/reader/wgsl/token_test.cc b/src/reader/wgsl/token_test.cc index 4daa091..13d467e 100644 --- a/src/reader/wgsl/token_test.cc +++ b/src/reader/wgsl/token_test.cc
@@ -26,48 +26,48 @@ using TokenTest = testing::Test; TEST_F(TokenTest, ReturnsStr) { - Token t(Token::Type::kStringLiteral, Source{1, 1}, "test string"); + Token t(Token::Type::kStringLiteral, Source{}, "test string"); EXPECT_EQ(t.to_str(), "test string"); } TEST_F(TokenTest, ReturnsF32) { - Token t1(Source{1, 1}, -2.345f); + Token t1(Source{}, -2.345f); EXPECT_EQ(t1.to_f32(), -2.345f); - Token t2(Source{1, 1}, 2.345f); + Token t2(Source{}, 2.345f); EXPECT_EQ(t2.to_f32(), 2.345f); } TEST_F(TokenTest, ReturnsI32) { - Token t1(Source{1, 1}, -2345); + Token t1(Source{}, -2345); EXPECT_EQ(t1.to_i32(), -2345); - Token t2(Source{1, 1}, 2345); + Token t2(Source{}, 2345); EXPECT_EQ(t2.to_i32(), 2345); } TEST_F(TokenTest, HandlesMaxI32) { - Token t1(Source{1, 1}, std::numeric_limits<int32_t>::max()); + Token t1(Source{}, std::numeric_limits<int32_t>::max()); EXPECT_EQ(t1.to_i32(), std::numeric_limits<int32_t>::max()); } TEST_F(TokenTest, HandlesMinI32) { - Token t1(Source{1, 1}, std::numeric_limits<int32_t>::min()); + Token t1(Source{}, std::numeric_limits<int32_t>::min()); EXPECT_EQ(t1.to_i32(), std::numeric_limits<int32_t>::min()); } TEST_F(TokenTest, ReturnsU32) { - Token t2(Source{1, 1}, 2345u); + Token t2(Source{}, 2345u); EXPECT_EQ(t2.to_u32(), 2345u); } TEST_F(TokenTest, ReturnsMaxU32) { - Token t1(Source{1, 1}, std::numeric_limits<uint32_t>::max()); + Token t1(Source{}, std::numeric_limits<uint32_t>::max()); EXPECT_EQ(t1.to_u32(), std::numeric_limits<uint32_t>::max()); } TEST_F(TokenTest, Source) { - Token t(Token::Type::kUintLiteral, Source{3, 9}); + Token t(Token::Type::kUintLiteral, Source{Source::Location{3, 9}}); EXPECT_EQ(t.line(), 3u); EXPECT_EQ(t.column(), 9u); }
diff --git a/src/source.h b/src/source.h index 20242c9..4f689f4 100644 --- a/src/source.h +++ b/src/source.h
@@ -74,13 +74,6 @@ /// Constructs the Source with the Range |rng| and File |f|. inline Source(const Range& rng, File const* f) : range(rng), file(f) {} - /// Constructs the Source with the zero-length range starting at |line| and - /// |column| with a null File. - /// TODO(bclayton): Remove this constructor. - /// It purely exists to break up changes into bite sized pieces. - inline explicit Source(size_t line, size_t column) - : Source(Location{line, column}) {} - Range range; File const* file = nullptr; };
diff --git a/src/type_determiner_test.cc b/src/type_determiner_test.cc index ca53df6..81cf17c 100644 --- a/src/type_determiner_test.cc +++ b/src/type_determiner_test.cc
@@ -102,7 +102,7 @@ TEST_F(TypeDeterminerTest, Error_WithEmptySource) { FakeStmt s; - s.set_source(Source{0, 0}); + s.set_source(Source{}); EXPECT_FALSE(td()->DetermineResultType(&s)); EXPECT_EQ(td()->error(), @@ -111,7 +111,7 @@ TEST_F(TypeDeterminerTest, Stmt_Error_Unknown) { FakeStmt s; - s.set_source(Source{2, 30}); + s.set_source(Source{Source::Location{2, 30}}); EXPECT_FALSE(td()->DetermineResultType(&s)); EXPECT_EQ(td()->error(), @@ -400,7 +400,8 @@ ast::type::F32Type f32; ast::ExpressionList call_params; auto call_expr = std::make_unique<ast::CallExpression>( - std::make_unique<ast::IdentifierExpression>(Source{12, 34}, "func"), + std::make_unique<ast::IdentifierExpression>( + Source{Source::Location{12, 34}}, "func"), std::move(call_params)); ast::VariableList params0; auto func_main = @@ -454,7 +455,7 @@ TEST_F(TypeDeterminerTest, Expr_Error_Unknown) { FakeExpr e; - e.set_source(Source{2, 30}); + e.set_source(Source{Source::Location{2, 30}}); EXPECT_FALSE(td()->DetermineResultType(&e)); EXPECT_EQ(td()->error(), "2:30: unknown expression for type determination");
diff --git a/src/validator_control_block_test.cc b/src/validator_control_block_test.cc index 473b9e5..1489ce5 100644 --- a/src/validator_control_block_test.cc +++ b/src/validator_control_block_test.cc
@@ -49,7 +49,8 @@ var->set_constructor(std::make_unique<ast::ScalarConstructorExpression>( std::make_unique<ast::SintLiteral>(&f32, 3.14f))); - auto cond = std::make_unique<ast::IdentifierExpression>(Source{12, 34}, "a"); + auto cond = std::make_unique<ast::IdentifierExpression>( + Source{Source::Location{12, 34}}, "a"); ast::CaseSelectorList default_csl; auto block_default = std::make_unique<ast::BlockStatement>(); ast::CaseStatementList body; @@ -89,7 +90,7 @@ auto block = std::make_unique<ast::BlockStatement>(); block->append(std::make_unique<ast::VariableDeclStatement>(std::move(var))); block->append(std::make_unique<ast::SwitchStatement>( - Source{12, 34}, std::move(cond), std::move(body))); + Source{Source::Location{12, 34}}, std::move(cond), std::move(body))); EXPECT_TRUE(td()->DetermineStatements(block.get())) << td()->error(); EXPECT_FALSE(v()->ValidateStatements(block.get())); @@ -133,7 +134,8 @@ auto block = std::make_unique<ast::BlockStatement>(); block->append(std::make_unique<ast::VariableDeclStatement>(std::move(var))); block->append(std::make_unique<ast::SwitchStatement>( - Source{12, 34}, std::move(cond), std::move(switch_body))); + Source{Source::Location{12, 34}}, std::move(cond), + std::move(switch_body))); EXPECT_TRUE(td()->DetermineStatements(block.get())) << td()->error(); EXPECT_FALSE(v()->ValidateStatements(block.get())); @@ -162,7 +164,8 @@ ast::CaseSelectorList csl; csl.push_back(std::make_unique<ast::UintLiteral>(&u32, 1)); switch_body.push_back(std::make_unique<ast::CaseStatement>( - Source{12, 34}, std::move(csl), std::make_unique<ast::BlockStatement>())); + Source{Source::Location{12, 34}}, std::move(csl), + std::make_unique<ast::BlockStatement>())); ast::CaseSelectorList default_csl; auto block_default = std::make_unique<ast::BlockStatement>(); @@ -201,7 +204,8 @@ ast::CaseSelectorList csl; csl.push_back(std::make_unique<ast::SintLiteral>(&i32, -1)); switch_body.push_back(std::make_unique<ast::CaseStatement>( - Source{12, 34}, std::move(csl), std::make_unique<ast::BlockStatement>())); + Source{Source::Location{12, 34}}, std::move(csl), + std::make_unique<ast::BlockStatement>())); ast::CaseSelectorList default_csl; auto block_default = std::make_unique<ast::BlockStatement>(); @@ -245,7 +249,7 @@ csl_2.push_back(std::make_unique<ast::UintLiteral>(&u32, 2)); csl_2.push_back(std::make_unique<ast::UintLiteral>(&u32, 2)); switch_body.push_back(std::make_unique<ast::CaseStatement>( - Source{12, 34}, std::move(csl_2), + Source{Source::Location{12, 34}}, std::move(csl_2), std::make_unique<ast::BlockStatement>())); ast::CaseSelectorList default_csl; @@ -292,7 +296,7 @@ csl_2.push_back(std::make_unique<ast::SintLiteral>(&i32, 2)); csl_2.push_back(std::make_unique<ast::SintLiteral>(&i32, 10)); switch_body.push_back(std::make_unique<ast::CaseStatement>( - Source{12, 34}, std::move(csl_2), + Source{Source::Location{12, 34}}, std::move(csl_2), std::make_unique<ast::BlockStatement>())); ast::CaseSelectorList default_csl; @@ -326,8 +330,8 @@ auto cond = std::make_unique<ast::IdentifierExpression>("a"); ast::CaseSelectorList default_csl; auto block_default = std::make_unique<ast::BlockStatement>(); - block_default->append( - std::make_unique<ast::FallthroughStatement>(Source{12, 34})); + block_default->append(std::make_unique<ast::FallthroughStatement>( + Source{Source::Location{12, 34}})); ast::CaseStatementList body; body.push_back(std::make_unique<ast::CaseStatement>( std::move(default_csl), std::move(block_default))); @@ -361,7 +365,8 @@ auto block_default = std::make_unique<ast::BlockStatement>(); ast::CaseStatementList body; body.push_back(std::make_unique<ast::CaseStatement>( - Source{12, 34}, std::move(default_csl), std::move(block_default))); + Source{Source::Location{12, 34}}, std::move(default_csl), + std::move(block_default))); ast::CaseSelectorList case_csl; case_csl.push_back(std::make_unique<ast::SintLiteral>(&i32, 5)); auto block_case = std::make_unique<ast::BlockStatement>(); @@ -397,7 +402,8 @@ auto block_default = std::make_unique<ast::BlockStatement>(); ast::CaseStatementList body; body.push_back(std::make_unique<ast::CaseStatement>( - Source{12, 34}, std::move(default_csl), std::move(block_default))); + Source{Source::Location{12, 34}}, std::move(default_csl), + std::move(block_default))); auto block = std::make_unique<ast::BlockStatement>(); block->append(std::make_unique<ast::VariableDeclStatement>(std::move(var)));
diff --git a/src/validator_function_test.cc b/src/validator_function_test.cc index 145b345..4fb9ad5 100644 --- a/src/validator_function_test.cc +++ b/src/validator_function_test.cc
@@ -47,8 +47,8 @@ ast::VariableList params; ast::type::VoidType void_type; - auto func = std::make_unique<ast::Function>(Source{12, 34}, "func", - std::move(params), &void_type); + auto func = std::make_unique<ast::Function>( + Source{Source::Location{12, 34}}, "func", std::move(params), &void_type); auto body = std::make_unique<ast::BlockStatement>(); body->append(std::make_unique<ast::VariableDeclStatement>(std::move(var))); func->set_body(std::move(body)); @@ -64,8 +64,8 @@ // fn func -> void {} ast::type::VoidType void_type; ast::VariableList params; - auto func = std::make_unique<ast::Function>(Source{12, 34}, "func", - std::move(params), &void_type); + auto func = std::make_unique<ast::Function>( + Source{Source::Location{12, 34}}, "func", std::move(params), &void_type); mod()->AddFunction(std::move(func)); EXPECT_TRUE(td()->Determine()) << td()->error(); @@ -104,8 +104,8 @@ auto return_expr = std::make_unique<ast::ScalarConstructorExpression>( std::make_unique<ast::SintLiteral>(&i32, 2)); - body->append(std::make_unique<ast::ReturnStatement>(Source{12, 34}, - std::move(return_expr))); + body->append(std::make_unique<ast::ReturnStatement>( + Source{Source::Location{12, 34}}, std::move(return_expr))); func->set_body(std::move(body)); mod()->AddFunction(std::move(func)); @@ -127,8 +127,8 @@ auto return_expr = std::make_unique<ast::ScalarConstructorExpression>( std::make_unique<ast::SintLiteral>(&i32, 2)); - body->append(std::make_unique<ast::ReturnStatement>(Source{12, 34}, - std::move(return_expr))); + body->append(std::make_unique<ast::ReturnStatement>( + Source{Source::Location{12, 34}}, std::move(return_expr))); func->set_body(std::move(body)); mod()->AddFunction(std::move(func)); @@ -157,7 +157,7 @@ ast::VariableList params_copy; auto func_copy = std::make_unique<ast::Function>( - Source{12, 34}, "func", std::move(params_copy), &i32); + Source{Source::Location{12, 34}}, "func", std::move(params_copy), &i32); auto body_copy = std::make_unique<ast::BlockStatement>(); auto return_expr_copy = std::make_unique<ast::ScalarConstructorExpression>( std::make_unique<ast::SintLiteral>(&i32, 2)); @@ -181,7 +181,8 @@ ast::type::VoidType void_type; ast::ExpressionList call_params; auto call_expr = std::make_unique<ast::CallExpression>( - Source{12, 34}, std::make_unique<ast::IdentifierExpression>("func"), + Source{Source::Location{12, 34}}, + std::make_unique<ast::IdentifierExpression>("func"), std::move(call_params)); ast::VariableList params0; auto func0 = @@ -204,7 +205,8 @@ std::make_unique<ast::Variable>("a", ast::StorageClass::kNone, &i32); ast::ExpressionList call_params; auto call_expr = std::make_unique<ast::CallExpression>( - Source{12, 34}, std::make_unique<ast::IdentifierExpression>("func"), + Source{Source::Location{12, 34}}, + std::make_unique<ast::IdentifierExpression>("func"), std::move(call_params)); var->set_constructor(std::move(call_expr)); ast::VariableList params0; @@ -229,8 +231,8 @@ // fn vtx_main() -> i32 { return 0; } ast::type::I32Type i32; ast::VariableList params; - auto func = std::make_unique<ast::Function>(Source{12, 34}, "vtx_main", - std::move(params), &i32); + auto func = std::make_unique<ast::Function>( + Source{Source::Location{12, 34}}, "vtx_main", std::move(params), &i32); auto return_expr = std::make_unique<ast::ScalarConstructorExpression>( std::make_unique<ast::SintLiteral>(&i32, 0)); @@ -255,8 +257,9 @@ ast::VariableList params; params.push_back( std::make_unique<ast::Variable>("a", ast::StorageClass::kNone, &i32)); - auto func = std::make_unique<ast::Function>(Source{12, 34}, "vtx_func", - std::move(params), &void_type); + auto func = std::make_unique<ast::Function>(Source{Source::Location{12, 34}}, + "vtx_func", std::move(params), + &void_type); auto body = std::make_unique<ast::BlockStatement>(); body->append(std::make_unique<ast::ReturnStatement>()); func->set_body(std::move(body)); @@ -278,8 +281,8 @@ // fn main() -> void { return; } ast::type::VoidType void_type; ast::VariableList params; - auto func = std::make_unique<ast::Function>(Source{5, 6}, "main", - std::move(params), &void_type); + auto func = std::make_unique<ast::Function>( + Source{Source::Location{5, 6}}, "main", std::move(params), &void_type); auto body = std::make_unique<ast::BlockStatement>(); body->append(std::make_unique<ast::ReturnStatement>()); func->set_body(std::move(body)); @@ -287,8 +290,8 @@ std::make_unique<ast::StageDecoration>(ast::PipelineStage::kVertex)); mod()->AddFunction(std::move(func)); - func = std::make_unique<ast::Function>(Source{12, 34}, "main", - std::move(params), &void_type); + func = std::make_unique<ast::Function>(Source{Source::Location{12, 34}}, + "main", std::move(params), &void_type); body = std::make_unique<ast::BlockStatement>(); body->append(std::make_unique<ast::ReturnStatement>()); func->set_body(std::move(body)); @@ -310,8 +313,8 @@ // fn main() -> void { return; } ast::type::VoidType void_type; ast::VariableList params; - auto func = std::make_unique<ast::Function>(Source{5, 6}, "main", - std::move(params), &void_type); + auto func = std::make_unique<ast::Function>( + Source{Source::Location{5, 6}}, "main", std::move(params), &void_type); auto body = std::make_unique<ast::BlockStatement>(); body->append(std::make_unique<ast::ReturnStatement>()); func->set_body(std::move(body)); @@ -319,8 +322,8 @@ std::make_unique<ast::StageDecoration>(ast::PipelineStage::kVertex)); mod()->AddFunction(std::move(func)); - func = std::make_unique<ast::Function>(Source{12, 34}, "main", - std::move(params), &void_type); + func = std::make_unique<ast::Function>(Source{Source::Location{12, 34}}, + "main", std::move(params), &void_type); body = std::make_unique<ast::BlockStatement>(); body->append(std::make_unique<ast::ReturnStatement>()); func->set_body(std::move(body));
diff --git a/src/validator_impl.cc b/src/validator_impl.cc index 78e09f1..1e681bb 100644 --- a/src/validator_impl.cc +++ b/src/validator_impl.cc
@@ -134,7 +134,7 @@ } if (pipeline_count == 0) { - set_error(Source{0, 0}, + set_error(Source{}, "v-0003: At least one of vertex, fragment or compute shader must " "be present"); return false;
diff --git a/src/validator_test.cc b/src/validator_test.cc index 4bcab97..a5236e2 100644 --- a/src/validator_test.cc +++ b/src/validator_test.cc
@@ -68,8 +68,8 @@ auto lhs = std::make_unique<ast::ScalarConstructorExpression>( std::make_unique<ast::SintLiteral>(&i32, 1)); auto rhs = std::make_unique<ast::IdentifierExpression>("my_var"); - ast::AssignmentStatement assign(Source{12, 34}, std::move(lhs), - std::move(rhs)); + ast::AssignmentStatement assign(Source{Source::Location{12, 34}}, + std::move(lhs), std::move(rhs)); // TODO(sarahM0): Invalidate assignment to scalar. ASSERT_TRUE(v()->has_error()); @@ -81,11 +81,12 @@ // b = 2; ast::type::I32Type i32; - auto lhs = std::make_unique<ast::IdentifierExpression>(Source{12, 34}, "b"); + auto lhs = std::make_unique<ast::IdentifierExpression>( + Source{Source::Location{12, 34}}, "b"); auto rhs = std::make_unique<ast::ScalarConstructorExpression>( std::make_unique<ast::SintLiteral>(&i32, 2)); auto assign = std::make_unique<ast::AssignmentStatement>( - Source{12, 34}, std::move(lhs), std::move(rhs)); + Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs)); EXPECT_FALSE(td()->DetermineResultType(assign.get())); EXPECT_EQ(td()->error(), @@ -98,13 +99,14 @@ // } ast::type::I32Type i32; - auto lhs = std::make_unique<ast::IdentifierExpression>(Source{12, 34}, "b"); + auto lhs = std::make_unique<ast::IdentifierExpression>( + Source{Source::Location{12, 34}}, "b"); auto rhs = std::make_unique<ast::ScalarConstructorExpression>( std::make_unique<ast::SintLiteral>(&i32, 2)); auto body = std::make_unique<ast::BlockStatement>(); body->append(std::make_unique<ast::AssignmentStatement>( - Source{12, 34}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); EXPECT_FALSE(td()->DetermineStatements(body.get())); EXPECT_EQ(td()->error(), @@ -126,8 +128,8 @@ std::make_unique<ast::SintLiteral>(&i32, 2)); auto* rhs_ptr = rhs.get(); - ast::AssignmentStatement assign(Source{12, 34}, std::move(lhs), - std::move(rhs)); + ast::AssignmentStatement assign(Source{Source::Location{12, 34}}, + std::move(lhs), std::move(rhs)); td()->RegisterVariableForTesting(var.get()); EXPECT_TRUE(td()->DetermineResultType(&assign)) << td()->error(); ASSERT_NE(lhs_ptr->result_type(), nullptr); @@ -153,8 +155,8 @@ std::make_unique<ast::FloatLiteral>(&f32, 2.3f)); auto* rhs_ptr = rhs.get(); - ast::AssignmentStatement assign(Source{12, 34}, std::move(lhs), - std::move(rhs)); + ast::AssignmentStatement assign(Source{Source::Location{12, 34}}, + std::move(lhs), std::move(rhs)); td()->RegisterVariableForTesting(var.get()); EXPECT_TRUE(td()->DetermineResultType(&assign)) << td()->error(); ASSERT_NE(lhs_ptr->result_type(), nullptr); @@ -187,7 +189,7 @@ auto body = std::make_unique<ast::BlockStatement>(); body->append(std::make_unique<ast::VariableDeclStatement>(std::move(var))); body->append(std::make_unique<ast::AssignmentStatement>( - Source{12, 34}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); EXPECT_TRUE(td()->DetermineStatements(body.get())) << td()->error(); ASSERT_NE(lhs_ptr->result_type(), nullptr); @@ -217,7 +219,7 @@ ast::BlockStatement block; block.append(std::make_unique<ast::VariableDeclStatement>(std::move(var))); block.append(std::make_unique<ast::AssignmentStatement>( - Source{12, 34}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); EXPECT_TRUE(td()->DetermineStatements(&block)) << td()->error(); ASSERT_NE(lhs_ptr->result_type(), nullptr); @@ -234,7 +236,8 @@ // var<in> gloabl_var: f32; ast::type::F32Type f32; auto global_var = std::make_unique<ast::Variable>( - Source{12, 34}, "global_var", ast::StorageClass::kInput, &f32); + Source{Source::Location{12, 34}}, "global_var", ast::StorageClass::kInput, + &f32); mod()->AddGlobalVariable(std::move(global_var)); EXPECT_TRUE(v()->ValidateGlobalVariables(mod()->global_variables())) << v()->error(); @@ -244,7 +247,8 @@ // var gloabl_var: f32; ast::type::F32Type f32; auto global_var = std::make_unique<ast::Variable>( - Source{12, 34}, "global_var", ast::StorageClass::kNone, &f32); + Source{Source::Location{12, 34}}, "global_var", ast::StorageClass::kNone, + &f32); mod()->AddGlobalVariable(std::move(global_var)); EXPECT_TRUE(td()->Determine()) << td()->error(); EXPECT_FALSE(v()->Validate(mod())); @@ -255,7 +259,8 @@ // const<in> gloabl_var: f32; ast::type::F32Type f32; auto global_var = std::make_unique<ast::Variable>( - Source{12, 34}, "global_var", ast::StorageClass::kInput, &f32); + Source{Source::Location{12, 34}}, "global_var", ast::StorageClass::kInput, + &f32); global_var->set_is_const(true); mod()->AddGlobalVariable(std::move(global_var)); @@ -270,7 +275,8 @@ // const gloabl_var: f32; ast::type::F32Type f32; auto global_var = std::make_unique<ast::Variable>( - Source{12, 34}, "global_var", ast::StorageClass::kNone, &f32); + Source{Source::Location{12, 34}}, "global_var", ast::StorageClass::kNone, + &f32); global_var->set_is_const(true); mod()->AddGlobalVariable(std::move(global_var)); @@ -291,8 +297,8 @@ std::make_unique<ast::FloatLiteral>(&f32, 2.1))); mod()->AddGlobalVariable(std::move(global_var)); - auto lhs = std::make_unique<ast::IdentifierExpression>(Source{12, 34}, - "not_global_var"); + auto lhs = std::make_unique<ast::IdentifierExpression>( + Source{Source::Location{12, 34}}, "not_global_var"); auto rhs = std::make_unique<ast::ScalarConstructorExpression>( std::make_unique<ast::FloatLiteral>(&f32, 3.14f)); @@ -302,7 +308,7 @@ auto body = std::make_unique<ast::BlockStatement>(); body->append(std::make_unique<ast::AssignmentStatement>( - Source{12, 34}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); func->set_body(std::move(body)); mod()->AddFunction(std::move(func)); @@ -336,7 +342,7 @@ auto body = std::make_unique<ast::BlockStatement>(); body->append(std::make_unique<ast::AssignmentStatement>( - Source{12, 34}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); body->append(std::make_unique<ast::ReturnStatement>()); func->set_body(std::move(body)); func->add_decoration( @@ -364,7 +370,8 @@ auto body = std::make_unique<ast::BlockStatement>(); body->append(std::make_unique<ast::VariableDeclStatement>(std::move(var))); - auto lhs = std::make_unique<ast::IdentifierExpression>(Source{12, 34}, "a"); + auto lhs = std::make_unique<ast::IdentifierExpression>( + Source{Source::Location{12, 34}}, "a"); auto* lhs_ptr = lhs.get(); auto rhs = std::make_unique<ast::ScalarConstructorExpression>( std::make_unique<ast::FloatLiteral>(&f32, 3.14f)); @@ -374,7 +381,7 @@ outer_body->append( std::make_unique<ast::IfStatement>(std::move(cond), std::move(body))); outer_body->append(std::make_unique<ast::AssignmentStatement>( - Source{12, 34}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); EXPECT_TRUE(td()->DetermineStatements(outer_body.get())) << td()->error(); ASSERT_NE(lhs_ptr->result_type(), nullptr); @@ -394,7 +401,8 @@ var->set_constructor(std::make_unique<ast::ScalarConstructorExpression>( std::make_unique<ast::FloatLiteral>(&f32, 2.0))); - auto lhs = std::make_unique<ast::IdentifierExpression>(Source{12, 34}, "a"); + auto lhs = std::make_unique<ast::IdentifierExpression>( + Source{Source::Location{12, 34}}, "a"); auto* lhs_ptr = lhs.get(); auto rhs = std::make_unique<ast::ScalarConstructorExpression>( std::make_unique<ast::FloatLiteral>(&f32, 3.14f)); @@ -404,7 +412,7 @@ std::make_unique<ast::BoolLiteral>(&bool_type, true)); auto body = std::make_unique<ast::BlockStatement>(); body->append(std::make_unique<ast::AssignmentStatement>( - Source{12, 34}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); auto outer_body = std::make_unique<ast::BlockStatement>(); outer_body->append( @@ -429,7 +437,8 @@ mod()->AddGlobalVariable(std::move(var0)); auto var1 = std::make_unique<ast::Variable>( - Source{12, 34}, "global_var1", ast::StorageClass::kPrivate, &f32); + Source{Source::Location{12, 34}}, "global_var1", + ast::StorageClass::kPrivate, &f32); var1->set_constructor(std::make_unique<ast::ScalarConstructorExpression>( std::make_unique<ast::SintLiteral>(&i32, 0))); mod()->AddGlobalVariable(std::move(var1)); @@ -450,7 +459,8 @@ mod()->AddGlobalVariable(std::move(var0)); auto var1 = std::make_unique<ast::Variable>( - Source{12, 34}, "global_var", ast::StorageClass::kPrivate, &f32); + Source{Source::Location{12, 34}}, "global_var", + ast::StorageClass::kPrivate, &f32); var1->set_constructor(std::make_unique<ast::ScalarConstructorExpression>( std::make_unique<ast::SintLiteral>(&i32, 0))); mod()->AddGlobalVariable(std::move(var1)); @@ -481,7 +491,7 @@ auto body = std::make_unique<ast::BlockStatement>(); body->append(std::make_unique<ast::VariableDeclStatement>(std::move(var))); body->append(std::make_unique<ast::AssignmentStatement>( - Source{12, 34}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); EXPECT_TRUE(td()->DetermineStatements(body.get())) << td()->error(); ASSERT_NE(lhs_ptr->result_type(), nullptr); @@ -515,8 +525,8 @@ auto func = std::make_unique<ast::Function>("my_func", std::move(params), &void_type); auto body = std::make_unique<ast::BlockStatement>(); - body->append(std::make_unique<ast::VariableDeclStatement>(Source{12, 34}, - std::move(var))); + body->append(std::make_unique<ast::VariableDeclStatement>( + Source{Source::Location{12, 34}}, std::move(var))); func->set_body(std::move(body)); auto* func_ptr = func.get(); mod()->AddFunction(std::move(func)); @@ -552,7 +562,7 @@ auto body = std::make_unique<ast::BlockStatement>(); body->append(std::make_unique<ast::VariableDeclStatement>(std::move(var))); body->append(std::make_unique<ast::VariableDeclStatement>( - Source{12, 34}, std::move(var_a_float))); + Source{Source::Location{12, 34}}, std::move(var_a_float))); func->set_body(std::move(body)); auto* func_ptr = func.get(); mod()->AddFunction(std::move(func)); @@ -590,7 +600,7 @@ outer_body->append( std::make_unique<ast::IfStatement>(std::move(cond), std::move(body))); outer_body->append(std::make_unique<ast::VariableDeclStatement>( - Source{12, 34}, std::move(var_a_float))); + Source{Source::Location{12, 34}}, std::move(var_a_float))); EXPECT_TRUE(td()->DetermineStatements(outer_body.get())) << td()->error(); EXPECT_TRUE(v()->ValidateStatements(outer_body.get())) << v()->error(); @@ -619,8 +629,8 @@ auto cond = std::make_unique<ast::ScalarConstructorExpression>( std::make_unique<ast::BoolLiteral>(&bool_type, true)); auto body = std::make_unique<ast::BlockStatement>(); - body->append(std::make_unique<ast::VariableDeclStatement>(Source{12, 34}, - std::move(var))); + body->append(std::make_unique<ast::VariableDeclStatement>( + Source{Source::Location{12, 34}}, std::move(var))); auto outer_body = std::make_unique<ast::BlockStatement>(); outer_body->append( @@ -652,8 +662,8 @@ auto func0 = std::make_unique<ast::Function>("func0", std::move(params0), &void_type); auto body0 = std::make_unique<ast::BlockStatement>(); - body0->append(std::make_unique<ast::VariableDeclStatement>(Source{12, 34}, - std::move(var0))); + body0->append(std::make_unique<ast::VariableDeclStatement>( + Source{Source::Location{12, 34}}, std::move(var0))); body0->append(std::make_unique<ast::ReturnStatement>()); func0->set_body(std::move(body0)); @@ -661,8 +671,8 @@ auto func1 = std::make_unique<ast::Function>("func1", std::move(params1), &void_type); auto body1 = std::make_unique<ast::BlockStatement>(); - body1->append(std::make_unique<ast::VariableDeclStatement>(Source{13, 34}, - std::move(var1))); + body1->append(std::make_unique<ast::VariableDeclStatement>( + Source{Source::Location{13, 34}}, std::move(var1))); body1->append(std::make_unique<ast::ReturnStatement>()); func1->set_body(std::move(body1)); func1->add_decoration( @@ -694,7 +704,7 @@ auto body = std::make_unique<ast::BlockStatement>(); body->append(std::make_unique<ast::VariableDeclStatement>(std::move(var))); body->append(std::make_unique<ast::AssignmentStatement>( - Source{12, 34}, std::move(lhs), std::move(rhs))); + Source{Source::Location{12, 34}}, std::move(lhs), std::move(rhs))); EXPECT_TRUE(td()->DetermineStatements(body.get())) << td()->error(); ASSERT_NE(lhs_ptr->result_type(), nullptr);