ast: Add Source argument to literals
Bug: tint:396
Bug: tint:390
Change-Id: Ib78c19533dc65c85e2381bf1ce0d0966dd7babe9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35019
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
diff --git a/src/ast/bool_literal.cc b/src/ast/bool_literal.cc
index 4c6af63..c21d87f 100644
--- a/src/ast/bool_literal.cc
+++ b/src/ast/bool_literal.cc
@@ -22,8 +22,8 @@
namespace tint {
namespace ast {
-BoolLiteral::BoolLiteral(type::Type* type, bool value)
- : Base(type), value_(value) {}
+BoolLiteral::BoolLiteral(const Source& source, type::Type* type, bool value)
+ : Base(source, type), value_(value) {}
BoolLiteral::~BoolLiteral() = default;
@@ -36,7 +36,8 @@
}
BoolLiteral* BoolLiteral::Clone(CloneContext* ctx) const {
- return ctx->mod->create<BoolLiteral>(ctx->Clone(type()), value_);
+ return ctx->mod->create<BoolLiteral>(ctx->Clone(source()), ctx->Clone(type()),
+ value_);
}
} // namespace ast
diff --git a/src/ast/bool_literal.h b/src/ast/bool_literal.h
index c95ca82..1b984f5 100644
--- a/src/ast/bool_literal.h
+++ b/src/ast/bool_literal.h
@@ -26,9 +26,10 @@
class BoolLiteral : public Castable<BoolLiteral, Literal> {
public:
/// Constructor
+ /// @param source the input source
/// @param type the type of the literal
/// @param value the bool literals value
- BoolLiteral(type::Type* type, bool value);
+ BoolLiteral(const Source& source, type::Type* type, bool value);
~BoolLiteral() override;
/// @returns true if the bool literal is true
diff --git a/src/ast/bool_literal_test.cc b/src/ast/bool_literal_test.cc
index 186d71e..d98f988 100644
--- a/src/ast/bool_literal_test.cc
+++ b/src/ast/bool_literal_test.cc
@@ -29,7 +29,7 @@
TEST_F(BoolLiteralTest, True) {
type::Bool bool_type;
- BoolLiteral b{&bool_type, true};
+ BoolLiteral b{Source{}, &bool_type, true};
ASSERT_TRUE(b.Is<BoolLiteral>());
ASSERT_TRUE(b.IsTrue());
ASSERT_FALSE(b.IsFalse());
@@ -37,7 +37,7 @@
TEST_F(BoolLiteralTest, False) {
type::Bool bool_type;
- BoolLiteral b{&bool_type, false};
+ BoolLiteral b{Source{}, &bool_type, false};
ASSERT_TRUE(b.Is<BoolLiteral>());
ASSERT_FALSE(b.IsTrue());
ASSERT_TRUE(b.IsFalse());
@@ -45,7 +45,7 @@
TEST_F(BoolLiteralTest, Is) {
type::Bool bool_type;
- BoolLiteral b{&bool_type, false};
+ BoolLiteral b{Source{}, &bool_type, false};
Literal* l = &b;
EXPECT_TRUE(l->Is<BoolLiteral>());
EXPECT_FALSE(l->Is<SintLiteral>());
@@ -57,8 +57,8 @@
TEST_F(BoolLiteralTest, ToStr) {
type::Bool bool_type;
- BoolLiteral t{&bool_type, true};
- BoolLiteral f{&bool_type, false};
+ BoolLiteral t{Source{}, &bool_type, true};
+ BoolLiteral f{Source{}, &bool_type, false};
EXPECT_EQ(t.to_str(), "true");
EXPECT_EQ(f.to_str(), "false");
diff --git a/src/ast/builder.h b/src/ast/builder.h
index 189ebdb..63e625c 100644
--- a/src/ast/builder.h
+++ b/src/ast/builder.h
@@ -275,19 +275,27 @@
/// @param val the boolan value
/// @return a boolean literal with the given value
- BoolLiteral* Literal(bool val) { return create<BoolLiteral>(ty.bool_, val); }
+ BoolLiteral* Literal(bool val) {
+ return create<BoolLiteral>(Source{}, ty.bool_, val);
+ }
/// @param val the float value
/// @return a float literal with the given value
- FloatLiteral* Literal(f32 val) { return create<FloatLiteral>(ty.f32, val); }
+ FloatLiteral* Literal(f32 val) {
+ return create<FloatLiteral>(Source{}, ty.f32, val);
+ }
/// @param val the unsigned int value
/// @return a UintLiteral with the given value
- UintLiteral* Literal(u32 val) { return create<UintLiteral>(ty.u32, val); }
+ UintLiteral* Literal(u32 val) {
+ return create<UintLiteral>(Source{}, ty.u32, val);
+ }
/// @param val the integer value
/// @return the SintLiteral with the given value
- SintLiteral* Literal(i32 val) { return create<SintLiteral>(ty.i32, val); }
+ SintLiteral* Literal(i32 val) {
+ return create<SintLiteral>(Source{}, ty.i32, val);
+ }
/// @param args the arguments for the type constructor
/// @return an `TypeConstructorExpression` of type `ty`, with the values
diff --git a/src/ast/case_statement_test.cc b/src/ast/case_statement_test.cc
index 37617a8..9ecf1bb 100644
--- a/src/ast/case_statement_test.cc
+++ b/src/ast/case_statement_test.cc
@@ -32,7 +32,7 @@
type::I32 i32;
CaseSelectorList b;
- auto* selector = create<SintLiteral>(&i32, 2);
+ auto* selector = create<SintLiteral>(Source{}, &i32, 2);
b.push_back(selector);
auto* body = create<BlockStatement>();
@@ -50,7 +50,7 @@
type::U32 u32;
CaseSelectorList b;
- auto* selector = create<SintLiteral>(&u32, 2);
+ auto* selector = create<SintLiteral>(Source{}, &u32, 2);
b.push_back(selector);
auto* body = create<BlockStatement>();
@@ -67,7 +67,7 @@
TEST_F(CaseStatementTest, Creation_WithSource) {
type::I32 i32;
CaseSelectorList b;
- b.push_back(create<SintLiteral>(&i32, 2));
+ b.push_back(create<SintLiteral>(Source{}, &i32, 2));
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
@@ -89,7 +89,7 @@
TEST_F(CaseStatementTest, IsDefault_WithSelectors) {
type::I32 i32;
CaseSelectorList b;
- b.push_back(create<SintLiteral>(&i32, 2));
+ b.push_back(create<SintLiteral>(Source{}, &i32, 2));
CaseStatement c(b, create<BlockStatement>());
EXPECT_FALSE(c.IsDefault());
@@ -108,7 +108,7 @@
TEST_F(CaseStatementTest, IsValid_NullBodyStatement) {
type::I32 i32;
CaseSelectorList b;
- b.push_back(create<SintLiteral>(&i32, 2));
+ b.push_back(create<SintLiteral>(Source{}, &i32, 2));
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
@@ -121,7 +121,7 @@
TEST_F(CaseStatementTest, IsValid_InvalidBodyStatement) {
type::I32 i32;
CaseSelectorList b;
- b.push_back(create<SintLiteral>(&i32, 2));
+ b.push_back(create<SintLiteral>(Source{}, &i32, 2));
auto* body = create<BlockStatement>();
body->append(create<IfStatement>(Source{}, nullptr, create<BlockStatement>(),
@@ -134,7 +134,7 @@
TEST_F(CaseStatementTest, ToStr_WithSelectors_i32) {
type::I32 i32;
CaseSelectorList b;
- b.push_back(create<SintLiteral>(&i32, -2));
+ b.push_back(create<SintLiteral>(Source{}, &i32, -2));
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
@@ -151,7 +151,7 @@
TEST_F(CaseStatementTest, ToStr_WithSelectors_u32) {
type::U32 u32;
CaseSelectorList b;
- b.push_back(create<UintLiteral>(&u32, 2));
+ b.push_back(create<UintLiteral>(Source{}, &u32, 2));
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
@@ -169,8 +169,8 @@
type::I32 i32;
CaseSelectorList b;
- b.push_back(create<SintLiteral>(&i32, 1));
- b.push_back(create<SintLiteral>(&i32, 2));
+ b.push_back(create<SintLiteral>(Source{}, &i32, 1));
+ b.push_back(create<SintLiteral>(Source{}, &i32, 2));
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
diff --git a/src/ast/clone_context.h b/src/ast/clone_context.h
index 7733b85..9bfb906 100644
--- a/src/ast/clone_context.h
+++ b/src/ast/clone_context.h
@@ -109,7 +109,8 @@
/// // Replace all ast::UintLiterals with the number 42
/// CloneCtx ctx(mod);
/// ctx.ReplaceAll([&] (ast::UintLiteral* in) {
- /// return ctx.mod->create<ast::UintLiteral>(ctx.Clone(in->type()), 42);
+ /// return ctx.mod->create<ast::UintLiteral>(ctx.Clone(in->source()),
+ /// ctx.Clone(in->type()), 42);
/// });
/// auto* out = ctx.Clone(tree);
/// ```
diff --git a/src/ast/else_statement_test.cc b/src/ast/else_statement_test.cc
index 98dfd71..58a75af 100644
--- a/src/ast/else_statement_test.cc
+++ b/src/ast/else_statement_test.cc
@@ -30,7 +30,7 @@
TEST_F(ElseStatementTest, Creation) {
type::Bool bool_type;
auto* cond = create<ScalarConstructorExpression>(
- create<BoolLiteral>(&bool_type, true));
+ create<BoolLiteral>(Source{}, &bool_type, true));
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
@@ -57,7 +57,7 @@
TEST_F(ElseStatementTest, HasCondition) {
type::Bool bool_type;
auto* cond = create<ScalarConstructorExpression>(
- create<BoolLiteral>(&bool_type, true));
+ create<BoolLiteral>(Source{}, &bool_type, true));
ElseStatement e(cond, create<BlockStatement>());
EXPECT_TRUE(e.HasCondition());
}
@@ -107,7 +107,7 @@
TEST_F(ElseStatementTest, ToStr) {
type::Bool bool_type;
auto* cond = create<ScalarConstructorExpression>(
- create<BoolLiteral>(&bool_type, true));
+ create<BoolLiteral>(Source{}, &bool_type, true));
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
diff --git a/src/ast/float_literal.cc b/src/ast/float_literal.cc
index d6f30c7..5ce4347 100644
--- a/src/ast/float_literal.cc
+++ b/src/ast/float_literal.cc
@@ -25,8 +25,8 @@
namespace tint {
namespace ast {
-FloatLiteral::FloatLiteral(type::Type* type, float value)
- : Base(type), value_(value) {}
+FloatLiteral::FloatLiteral(const Source& source, type::Type* type, float value)
+ : Base(source, type), value_(value) {}
FloatLiteral::~FloatLiteral() = default;
@@ -43,7 +43,8 @@
}
FloatLiteral* FloatLiteral::Clone(CloneContext* ctx) const {
- return ctx->mod->create<FloatLiteral>(ctx->Clone(type()), value_);
+ return ctx->mod->create<FloatLiteral>(ctx->Clone(source()),
+ ctx->Clone(type()), value_);
}
} // namespace ast
diff --git a/src/ast/float_literal.h b/src/ast/float_literal.h
index 9e55e47..ad33124 100644
--- a/src/ast/float_literal.h
+++ b/src/ast/float_literal.h
@@ -26,9 +26,10 @@
class FloatLiteral : public Castable<FloatLiteral, Literal> {
public:
/// Constructor
+ /// @param source the input source
/// @param type the type of the literal
/// @param value the float literals value
- FloatLiteral(type::Type* type, float value);
+ FloatLiteral(const Source& source, type::Type* type, float value);
~FloatLiteral() override;
/// @returns the float literal value
diff --git a/src/ast/float_literal_test.cc b/src/ast/float_literal_test.cc
index 77b03f6..2b4394e 100644
--- a/src/ast/float_literal_test.cc
+++ b/src/ast/float_literal_test.cc
@@ -29,14 +29,14 @@
TEST_F(FloatLiteralTest, Value) {
type::F32 f32;
- FloatLiteral f{&f32, 47.2f};
+ FloatLiteral f{Source{}, &f32, 47.2f};
ASSERT_TRUE(f.Is<FloatLiteral>());
EXPECT_EQ(f.value(), 47.2f);
}
TEST_F(FloatLiteralTest, Is) {
type::F32 f32;
- FloatLiteral f{&f32, 42.f};
+ FloatLiteral f{Source{}, &f32, 42.f};
Literal* l = &f;
EXPECT_FALSE(l->Is<BoolLiteral>());
EXPECT_FALSE(l->Is<SintLiteral>());
@@ -48,14 +48,14 @@
TEST_F(FloatLiteralTest, ToStr) {
type::F32 f32;
- FloatLiteral f{&f32, 42.1f};
+ FloatLiteral f{Source{}, &f32, 42.1f};
EXPECT_EQ(f.to_str(), "42.099998");
}
TEST_F(FloatLiteralTest, ToName) {
type::F32 f32;
- FloatLiteral f{&f32, 42.1f};
+ FloatLiteral f{Source{}, &f32, 42.1f};
EXPECT_EQ(f.name(), "__float42.0999985");
}
diff --git a/src/ast/int_literal.cc b/src/ast/int_literal.cc
index aa35f3c..e48801e 100644
--- a/src/ast/int_literal.cc
+++ b/src/ast/int_literal.cc
@@ -19,7 +19,8 @@
namespace tint {
namespace ast {
-IntLiteral::IntLiteral(type::Type* type) : Base(type) {}
+IntLiteral::IntLiteral(const Source& source, type::Type* type)
+ : Base(source, type) {}
IntLiteral::~IntLiteral() = default;
diff --git a/src/ast/int_literal.h b/src/ast/int_literal.h
index 49ecda4..f522c1e 100644
--- a/src/ast/int_literal.h
+++ b/src/ast/int_literal.h
@@ -27,8 +27,9 @@
protected:
/// Constructor
+ /// @param source the input source
/// @param type the type of the literal
- explicit IntLiteral(type::Type* type);
+ IntLiteral(const Source& source, type::Type* type);
};
} // namespace ast
diff --git a/src/ast/int_literal_test.cc b/src/ast/int_literal_test.cc
index 3a1eb75..edf7440 100644
--- a/src/ast/int_literal_test.cc
+++ b/src/ast/int_literal_test.cc
@@ -31,13 +31,13 @@
TEST_F(IntLiteralTest, Sint_IsInt) {
type::I32 i32;
- SintLiteral i{&i32, 47};
+ SintLiteral i{Source{}, &i32, 47};
ASSERT_TRUE(i.Is<IntLiteral>());
}
TEST_F(IntLiteralTest, Uint_IsInt) {
type::I32 i32;
- UintLiteral i{&i32, 42};
+ UintLiteral i{Source{}, &i32, 42};
EXPECT_TRUE(i.Is<IntLiteral>());
}
diff --git a/src/ast/literal.cc b/src/ast/literal.cc
index 77a7612..05375ad 100644
--- a/src/ast/literal.cc
+++ b/src/ast/literal.cc
@@ -19,7 +19,8 @@
namespace tint {
namespace ast {
-Literal::Literal(type::Type* type) : type_(type) {}
+Literal::Literal(const Source& source, type::Type* type)
+ : Base(source), type_(type) {}
Literal::~Literal() = default;
diff --git a/src/ast/literal.h b/src/ast/literal.h
index 947ed38..dea8a63 100644
--- a/src/ast/literal.h
+++ b/src/ast/literal.h
@@ -47,8 +47,9 @@
protected:
/// Constructor
+ /// @param source the input source
/// @param type the type of the literal
- explicit Literal(type::Type* type);
+ explicit Literal(const Source& source, type::Type* type);
private:
type::Type* type_ = nullptr;
diff --git a/src/ast/node.h b/src/ast/node.h
index f72c41a..42301d5 100644
--- a/src/ast/node.h
+++ b/src/ast/node.h
@@ -64,7 +64,7 @@
/// Create a new node
Node();
/// Create a new node
- /// @param source The input source for the node
+ /// @param source the input source for the node
explicit Node(const Source& source);
/// Move constructor
Node(Node&&);
diff --git a/src/ast/null_literal.cc b/src/ast/null_literal.cc
index 4ae8324..9b654a3 100644
--- a/src/ast/null_literal.cc
+++ b/src/ast/null_literal.cc
@@ -22,7 +22,8 @@
namespace tint {
namespace ast {
-NullLiteral::NullLiteral(type::Type* type) : Base(type) {}
+NullLiteral::NullLiteral(const Source& source, type::Type* type)
+ : Base(source, type) {}
NullLiteral::~NullLiteral() = default;
@@ -35,7 +36,8 @@
}
NullLiteral* NullLiteral::Clone(CloneContext* ctx) const {
- return ctx->mod->create<NullLiteral>(ctx->Clone(type()));
+ return ctx->mod->create<NullLiteral>(ctx->Clone(source()),
+ ctx->Clone(type()));
}
} // namespace ast
diff --git a/src/ast/null_literal.h b/src/ast/null_literal.h
index 8ae3ff0..31ada3b 100644
--- a/src/ast/null_literal.h
+++ b/src/ast/null_literal.h
@@ -26,8 +26,9 @@
class NullLiteral : public Castable<NullLiteral, Literal> {
public:
/// Constructor
+ /// @param source the input source
/// @param type the type
- explicit NullLiteral(type::Type* type);
+ NullLiteral(const Source& source, type::Type* type);
~NullLiteral() override;
/// @returns the name for this literal. This name is unique to this value.
diff --git a/src/ast/null_literal_test.cc b/src/ast/null_literal_test.cc
index 1ae8c83..1d2afa0 100644
--- a/src/ast/null_literal_test.cc
+++ b/src/ast/null_literal_test.cc
@@ -29,7 +29,7 @@
TEST_F(NullLiteralTest, Is) {
type::I32 i32;
- NullLiteral i{&i32};
+ NullLiteral i{Source{}, &i32};
Literal* l = &i;
EXPECT_FALSE(l->Is<BoolLiteral>());
EXPECT_FALSE(l->Is<SintLiteral>());
@@ -41,14 +41,14 @@
TEST_F(NullLiteralTest, ToStr) {
type::I32 i32;
- NullLiteral i{&i32};
+ NullLiteral i{Source{}, &i32};
EXPECT_EQ(i.to_str(), "null __i32");
}
TEST_F(NullLiteralTest, Name_I32) {
type::I32 i32;
- NullLiteral i{&i32};
+ NullLiteral i{Source{}, &i32};
EXPECT_EQ("__null__i32", i.name());
}
diff --git a/src/ast/scalar_constructor_expression_test.cc b/src/ast/scalar_constructor_expression_test.cc
index 0168356..cdb62f4 100644
--- a/src/ast/scalar_constructor_expression_test.cc
+++ b/src/ast/scalar_constructor_expression_test.cc
@@ -26,14 +26,14 @@
TEST_F(ScalarConstructorExpressionTest, Creation) {
type::Bool bool_type;
- auto* b = create<BoolLiteral>(&bool_type, true);
+ auto* b = create<BoolLiteral>(Source{}, &bool_type, true);
ScalarConstructorExpression c(b);
EXPECT_EQ(c.literal(), b);
}
TEST_F(ScalarConstructorExpressionTest, Creation_WithSource) {
type::Bool bool_type;
- auto* b = create<BoolLiteral>(&bool_type, true);
+ auto* b = create<BoolLiteral>(Source{}, &bool_type, true);
ScalarConstructorExpression c(Source{Source::Location{20, 2}}, b);
auto src = c.source();
EXPECT_EQ(src.range.begin.line, 20u);
@@ -42,7 +42,7 @@
TEST_F(ScalarConstructorExpressionTest, IsValid) {
type::Bool bool_type;
- auto* b = create<BoolLiteral>(&bool_type, true);
+ auto* b = create<BoolLiteral>(Source{}, &bool_type, true);
ScalarConstructorExpression c(b);
EXPECT_TRUE(c.IsValid());
}
@@ -54,7 +54,7 @@
TEST_F(ScalarConstructorExpressionTest, ToStr) {
type::Bool bool_type;
- auto* b = create<BoolLiteral>(&bool_type, true);
+ auto* b = create<BoolLiteral>(Source{}, &bool_type, true);
ScalarConstructorExpression c(b);
std::ostringstream out;
c.to_str(out, 2);
diff --git a/src/ast/sint_literal.cc b/src/ast/sint_literal.cc
index 0b3b4b3..52b8b0e 100644
--- a/src/ast/sint_literal.cc
+++ b/src/ast/sint_literal.cc
@@ -22,8 +22,8 @@
namespace tint {
namespace ast {
-SintLiteral::SintLiteral(type::Type* type, int32_t value)
- : Base(type), value_(value) {}
+SintLiteral::SintLiteral(const Source& source, type::Type* type, int32_t value)
+ : Base(source, type), value_(value) {}
SintLiteral::~SintLiteral() = default;
@@ -36,7 +36,8 @@
}
SintLiteral* SintLiteral::Clone(CloneContext* ctx) const {
- return ctx->mod->create<SintLiteral>(ctx->Clone(type()), value_);
+ return ctx->mod->create<SintLiteral>(ctx->Clone(source()), ctx->Clone(type()),
+ value_);
}
} // namespace ast
diff --git a/src/ast/sint_literal.h b/src/ast/sint_literal.h
index 9cba513..cf4ac57 100644
--- a/src/ast/sint_literal.h
+++ b/src/ast/sint_literal.h
@@ -26,9 +26,10 @@
class SintLiteral : public Castable<SintLiteral, IntLiteral> {
public:
/// Constructor
+ /// @param source the input source
/// @param type the type
/// @param value the signed int literals value
- SintLiteral(type::Type* type, int32_t value);
+ SintLiteral(const Source& source, type::Type* type, int32_t value);
~SintLiteral() override;
/// @returns the int literal value
diff --git a/src/ast/sint_literal_test.cc b/src/ast/sint_literal_test.cc
index 09b4a34..f4fcc08 100644
--- a/src/ast/sint_literal_test.cc
+++ b/src/ast/sint_literal_test.cc
@@ -30,14 +30,14 @@
TEST_F(SintLiteralTest, Value) {
type::I32 i32;
- SintLiteral i{&i32, 47};
+ SintLiteral i{Source{}, &i32, 47};
ASSERT_TRUE(i.Is<SintLiteral>());
EXPECT_EQ(i.value(), 47);
}
TEST_F(SintLiteralTest, Is) {
type::I32 i32;
- SintLiteral i{&i32, 42};
+ SintLiteral i{Source{}, &i32, 42};
Literal* l = &i;
EXPECT_FALSE(l->Is<BoolLiteral>());
EXPECT_TRUE(l->Is<SintLiteral>());
@@ -48,20 +48,20 @@
TEST_F(SintLiteralTest, ToStr) {
type::I32 i32;
- SintLiteral i{&i32, -42};
+ SintLiteral i{Source{}, &i32, -42};
EXPECT_EQ(i.to_str(), "-42");
}
TEST_F(SintLiteralTest, Name_I32) {
type::I32 i32;
- SintLiteral i{&i32, 2};
+ SintLiteral i{Source{}, &i32, 2};
EXPECT_EQ("__sint__i32_2", i.name());
}
TEST_F(SintLiteralTest, Name_U32) {
type::U32 u32;
- SintLiteral i{&u32, 2};
+ SintLiteral i{Source{}, &u32, 2};
EXPECT_EQ("__sint__u32_2", i.name());
}
diff --git a/src/ast/switch_statement_test.cc b/src/ast/switch_statement_test.cc
index bd610fa..4123237 100644
--- a/src/ast/switch_statement_test.cc
+++ b/src/ast/switch_statement_test.cc
@@ -32,7 +32,7 @@
type::I32 i32;
CaseSelectorList lit;
- lit.push_back(create<SintLiteral>(&i32, 1));
+ lit.push_back(create<SintLiteral>(Source{}, &i32, 1));
auto* ident =
create<IdentifierExpression>(mod.RegisterSymbol("ident"), "ident");
@@ -61,7 +61,7 @@
type::I32 i32;
CaseSelectorList lit;
- lit.push_back(create<SintLiteral>(&i32, 2));
+ lit.push_back(create<SintLiteral>(Source{}, &i32, 2));
auto* ident =
create<IdentifierExpression>(mod.RegisterSymbol("ident"), "ident");
@@ -76,7 +76,7 @@
type::I32 i32;
CaseSelectorList lit;
- lit.push_back(create<SintLiteral>(&i32, 2));
+ lit.push_back(create<SintLiteral>(Source{}, &i32, 2));
auto* ident =
create<IdentifierExpression>(mod.RegisterSymbol("ident"), "ident");
@@ -91,7 +91,7 @@
type::I32 i32;
CaseSelectorList lit;
- lit.push_back(create<SintLiteral>(&i32, 2));
+ lit.push_back(create<SintLiteral>(Source{}, &i32, 2));
CaseStatementList body;
body.push_back(create<CaseStatement>(lit, create<BlockStatement>()));
@@ -104,7 +104,7 @@
type::I32 i32;
CaseSelectorList lit;
- lit.push_back(create<SintLiteral>(&i32, 2));
+ lit.push_back(create<SintLiteral>(Source{}, &i32, 2));
auto* ident = create<IdentifierExpression>(mod.RegisterSymbol(""), "");
CaseStatementList body;
@@ -118,7 +118,7 @@
type::I32 i32;
CaseSelectorList lit;
- lit.push_back(create<SintLiteral>(&i32, 2));
+ lit.push_back(create<SintLiteral>(Source{}, &i32, 2));
auto* ident =
create<IdentifierExpression>(mod.RegisterSymbol("ident"), "ident");
@@ -163,7 +163,7 @@
type::I32 i32;
CaseSelectorList lit;
- lit.push_back(create<SintLiteral>(&i32, 2));
+ lit.push_back(create<SintLiteral>(Source{}, &i32, 2));
auto* ident =
create<IdentifierExpression>(mod.RegisterSymbol("ident"), "ident");
diff --git a/src/ast/uint_literal.cc b/src/ast/uint_literal.cc
index f361e4a..c30a608 100644
--- a/src/ast/uint_literal.cc
+++ b/src/ast/uint_literal.cc
@@ -22,8 +22,8 @@
namespace tint {
namespace ast {
-UintLiteral::UintLiteral(type::Type* type, uint32_t value)
- : Base(type), value_(value) {}
+UintLiteral::UintLiteral(const Source& source, type::Type* type, uint32_t value)
+ : Base(source, type), value_(value) {}
UintLiteral::~UintLiteral() = default;
@@ -36,7 +36,8 @@
}
UintLiteral* UintLiteral::Clone(CloneContext* ctx) const {
- return ctx->mod->create<UintLiteral>(ctx->Clone(type()), value_);
+ return ctx->mod->create<UintLiteral>(ctx->Clone(source()), ctx->Clone(type()),
+ value_);
}
} // namespace ast
diff --git a/src/ast/uint_literal.h b/src/ast/uint_literal.h
index 822fa8d..9010b6d 100644
--- a/src/ast/uint_literal.h
+++ b/src/ast/uint_literal.h
@@ -26,9 +26,10 @@
class UintLiteral : public Castable<UintLiteral, IntLiteral> {
public:
/// Constructor
+ /// @param source the input source
/// @param type the type of the literal
/// @param value the uint literals value
- UintLiteral(type::Type* type, uint32_t value);
+ UintLiteral(const Source& source, type::Type* type, uint32_t value);
~UintLiteral() override;
/// @returns the uint literal value
diff --git a/src/ast/uint_literal_test.cc b/src/ast/uint_literal_test.cc
index 579fdca..6090de1 100644
--- a/src/ast/uint_literal_test.cc
+++ b/src/ast/uint_literal_test.cc
@@ -29,14 +29,14 @@
TEST_F(UintLiteralTest, Value) {
type::U32 u32;
- UintLiteral u{&u32, 47};
+ UintLiteral u{Source{}, &u32, 47};
ASSERT_TRUE(u.Is<UintLiteral>());
EXPECT_EQ(u.value(), 47u);
}
TEST_F(UintLiteralTest, Is) {
type::U32 u32;
- UintLiteral u{&u32, 42};
+ UintLiteral u{Source{}, &u32, 42};
Literal* l = &u;
EXPECT_FALSE(l->Is<BoolLiteral>());
EXPECT_FALSE(l->Is<SintLiteral>());
@@ -47,9 +47,8 @@
TEST_F(UintLiteralTest, ToStr) {
type::U32 u32;
- UintLiteral i{&u32, 42};
-
- EXPECT_EQ(i.to_str(), "42");
+ UintLiteral u{Source{}, &u32, 42};
+ EXPECT_EQ(u.to_str(), "42");
}
} // namespace
diff --git a/src/inspector/inspector_test.cc b/src/inspector/inspector_test.cc
index 5a40623..337a705 100644
--- a/src/inspector/inspector_test.cc
+++ b/src/inspector/inspector_test.cc
@@ -228,28 +228,28 @@
/// @param val scalar value for the literal to contain
/// @returns a Literal of the expected type and value
ast::Literal* MakeLiteral(ast::type::Type* type, bool* val) {
- return create<ast::BoolLiteral>(type, *val);
+ return create<ast::BoolLiteral>(Source{}, type, *val);
}
/// @param type AST type of the literal, must resolve to UIntLiteral
/// @param val scalar value for the literal to contain
/// @returns a Literal of the expected type and value
ast::Literal* MakeLiteral(ast::type::Type* type, uint32_t* val) {
- return create<ast::UintLiteral>(type, *val);
+ return create<ast::UintLiteral>(Source{}, type, *val);
}
/// @param type AST type of the literal, must resolve to IntLiteral
/// @param val scalar value for the literal to contain
/// @returns a Literal of the expected type and value
ast::Literal* MakeLiteral(ast::type::Type* type, int32_t* val) {
- return create<ast::SintLiteral>(type, *val);
+ return create<ast::SintLiteral>(Source{}, type, *val);
}
/// @param type AST type of the literal, must resolve to FloattLiteral
/// @param val scalar value for the literal to contain
/// @returns a Literal of the expected type and value
ast::Literal* MakeLiteral(ast::type::Type* type, float* val) {
- return create<ast::FloatLiteral>(type, *val);
+ return create<ast::FloatLiteral>(Source{}, type, *val);
}
/// @param vec Vector of strings to be searched
diff --git a/src/reader/spirv/function.cc b/src/reader/spirv/function.cc
index e5d22bd..17b9ede 100644
--- a/src/reader/spirv/function.cc
+++ b/src/reader/spirv/function.cc
@@ -695,7 +695,7 @@
assert(!statements_stack_.empty());
const auto& top = statements_stack_.back();
- auto* cond = MakeTrue();
+ auto* cond = MakeTrue(Source{});
auto* body = create<ast::BlockStatement>();
AddStatement(
create<ast::IfStatement>(Source{}, cond, body, ast::ElseStatementList{}));
@@ -2142,7 +2142,7 @@
ast::StorageClass::kFunction, // storage_class
parser_impl_.Bool(), // type
false, // is_const
- MakeTrue(), // constructor
+ MakeTrue(Source{}), // constructor
ast::VariableDecorationList{}); // decorations
auto* guard_decl = create<ast::VariableDeclStatement>(guard_var);
AddStatement(guard_decl);
@@ -2354,10 +2354,10 @@
const uint32_t value32 = uint32_t(value & 0xFFFFFFFF);
if (selector.type->is_unsigned_scalar_or_vector()) {
selectors.emplace_back(
- create<ast::UintLiteral>(selector.type, value32));
+ create<ast::UintLiteral>(Source{}, selector.type, value32));
} else {
selectors.emplace_back(
- create<ast::SintLiteral>(selector.type, value32));
+ create<ast::SintLiteral>(Source{}, selector.type, value32));
}
}
}
@@ -2572,7 +2572,7 @@
return create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(
ast_module_.RegisterSymbol(flow_guard), flow_guard),
- MakeFalse());
+ MakeFalse(Source{}));
}
// For an unconditional branch, the break out to an if-selection
@@ -3256,7 +3256,7 @@
auto make_index = [this](uint32_t literal) {
auto* type = create<ast::type::U32>();
return create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(type, literal));
+ create<ast::UintLiteral>(Source{}, type, literal));
};
const auto composite = inst.GetSingleWordInOperand(0);
@@ -3356,15 +3356,15 @@
return current_expr;
}
-ast::Expression* FunctionEmitter::MakeTrue() const {
+ast::Expression* FunctionEmitter::MakeTrue(const Source& source) const {
return create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(parser_impl_.Bool(), true));
+ create<ast::BoolLiteral>(source, parser_impl_.Bool(), true));
}
-ast::Expression* FunctionEmitter::MakeFalse() const {
+ast::Expression* FunctionEmitter::MakeFalse(const Source& source) const {
ast::type::Bool bool_type;
return create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(parser_impl_.Bool(), false));
+ create<ast::BoolLiteral>(source, parser_impl_.Bool(), false));
}
TypedExpression FunctionEmitter::MakeVectorShuffle(
diff --git a/src/reader/spirv/function.h b/src/reader/spirv/function.h
index 8f8eeba..4b234fb 100644
--- a/src/reader/spirv/function.h
+++ b/src/reader/spirv/function.h
@@ -698,7 +698,7 @@
/// return the given value. Otherwise, wrap the value in a TypeConstructor
/// expression.
/// @param value the value to pass through or convert
- /// @reutrns the value as an I32 value.
+ /// @returns the value as an I32 value.
TypedExpression ToI32(TypedExpression value);
private:
@@ -865,10 +865,10 @@
void PushTrueGuard(uint32_t end_id);
/// @returns a boolean true expression.
- ast::Expression* MakeTrue() const;
+ ast::Expression* MakeTrue(const Source&) const;
/// @returns a boolean false expression.
- ast::Expression* MakeFalse() const;
+ ast::Expression* MakeFalse(const Source&) const;
/// Creates a new `ast::Node` owned by the Module. When the Module is
/// destructed, the `ast::Node` will also be destructed.
diff --git a/src/reader/spirv/parser_impl.cc b/src/reader/spirv/parser_impl.cc
index 9d46f47..9ef2d36 100644
--- a/src/reader/spirv/parser_impl.cc
+++ b/src/reader/spirv/parser_impl.cc
@@ -1033,7 +1033,7 @@
ast_type = ConvertType(inst.type_id());
ast_expr =
create<ast::ScalarConstructorExpression>(create<ast::BoolLiteral>(
- ast_type, inst.opcode() == SpvOpSpecConstantTrue));
+ Source{}, ast_type, inst.opcode() == SpvOpSpecConstantTrue));
break;
}
case SpvOpSpecConstant: {
@@ -1042,17 +1042,17 @@
if (ast_type->Is<ast::type::I32>()) {
ast_expr =
create<ast::ScalarConstructorExpression>(create<ast::SintLiteral>(
- ast_type, static_cast<int32_t>(literal_value)));
+ Source{}, ast_type, static_cast<int32_t>(literal_value)));
} else if (ast_type->Is<ast::type::U32>()) {
ast_expr =
create<ast::ScalarConstructorExpression>(create<ast::UintLiteral>(
- ast_type, static_cast<uint32_t>(literal_value)));
+ Source{}, ast_type, static_cast<uint32_t>(literal_value)));
} else if (ast_type->Is<ast::type::F32>()) {
float float_value;
// Copy the bits so we can read them as a float.
std::memcpy(&float_value, &literal_value, sizeof(float_value));
ast_expr = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(ast_type, float_value));
+ create<ast::FloatLiteral>(Source{}, ast_type, float_value));
} else {
return Fail() << " invalid result type for OpSpecConstant "
<< inst.PrettyPrint();
@@ -1314,6 +1314,7 @@
return {};
}
+ auto source = GetSourceForInst(inst);
auto* ast_type = original_ast_type->UnwrapIfNeeded();
// TODO(dneto): Note: NullConstant for int, uint, float map to a regular 0.
@@ -1322,25 +1323,25 @@
// See https://bugs.chromium.org/p/tint/issues/detail?id=34
if (ast_type->Is<ast::type::U32>()) {
return {ast_type,
- create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(ast_type, spirv_const->GetU32()))};
+ create<ast::ScalarConstructorExpression>(create<ast::UintLiteral>(
+ source, ast_type, spirv_const->GetU32()))};
}
if (ast_type->Is<ast::type::I32>()) {
return {ast_type,
- create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(ast_type, spirv_const->GetS32()))};
+ create<ast::ScalarConstructorExpression>(create<ast::SintLiteral>(
+ source, ast_type, spirv_const->GetS32()))};
}
if (ast_type->Is<ast::type::F32>()) {
return {ast_type,
- create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(ast_type, spirv_const->GetFloat()))};
+ create<ast::ScalarConstructorExpression>(create<ast::FloatLiteral>(
+ source, ast_type, spirv_const->GetFloat()))};
}
if (ast_type->Is<ast::type::Bool>()) {
const bool value = spirv_const->AsNullConstant()
? false
: spirv_const->AsBoolConstant()->value();
return {ast_type, create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(ast_type, value))};
+ create<ast::BoolLiteral>(source, ast_type, value))};
}
auto* spirv_composite_const = spirv_const->AsCompositeConstant();
if (spirv_composite_const != nullptr) {
@@ -1394,19 +1395,19 @@
if (type->Is<ast::type::Bool>()) {
return create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(type, false));
+ create<ast::BoolLiteral>(Source{}, type, false));
}
if (type->Is<ast::type::U32>()) {
return create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(type, 0u));
+ create<ast::UintLiteral>(Source{}, type, 0u));
}
if (type->Is<ast::type::I32>()) {
return create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(type, 0));
+ create<ast::SintLiteral>(Source{}, type, 0));
}
if (type->Is<ast::type::F32>()) {
return create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(type, 0.0f));
+ create<ast::FloatLiteral>(Source{}, type, 0.0f));
}
if (const auto* vec_ty = type->As<ast::type::Vector>()) {
ast::ExpressionList ast_components;
diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc
index b1db835..8098051 100644
--- a/src/reader/wgsl/parser_impl.cc
+++ b/src/reader/wgsl/parser_impl.cc
@@ -2678,19 +2678,19 @@
auto t = peek();
if (match(Token::Type::kTrue)) {
auto* type = module_.create<ast::type::Bool>();
- return create<ast::BoolLiteral>(type, true);
+ return create<ast::BoolLiteral>(Source{}, type, true);
}
if (match(Token::Type::kFalse)) {
auto* type = module_.create<ast::type::Bool>();
- return create<ast::BoolLiteral>(type, false);
+ return create<ast::BoolLiteral>(Source{}, type, false);
}
if (match(Token::Type::kSintLiteral)) {
auto* type = module_.create<ast::type::I32>();
- return create<ast::SintLiteral>(type, t.to_i32());
+ return create<ast::SintLiteral>(Source{}, type, t.to_i32());
}
if (match(Token::Type::kUintLiteral)) {
auto* type = module_.create<ast::type::U32>();
- return create<ast::UintLiteral>(type, t.to_u32());
+ return create<ast::UintLiteral>(Source{}, type, t.to_u32());
}
if (match(Token::Type::kFloatLiteral)) {
auto p = peek();
@@ -2699,7 +2699,7 @@
add_error(p.source(), "float literals must not be suffixed with 'f'");
}
auto* type = module_.create<ast::type::F32>();
- return create<ast::FloatLiteral>(type, t.to_f32());
+ return create<ast::FloatLiteral>(Source{}, type, t.to_f32());
}
return Failure::kNoMatch;
}
diff --git a/src/transform/bound_array_accessors.cc b/src/transform/bound_array_accessors.cc
index ba5e954..a5b53f2 100644
--- a/src/transform/bound_array_accessors.cc
+++ b/src/transform/bound_array_accessors.cc
@@ -105,13 +105,15 @@
} else if (val >= int32_t(size)) {
val = int32_t(size) - 1;
}
- lit = ctx->mod->create<ast::SintLiteral>(ctx->Clone(sint->type()), val);
+ lit = ctx->mod->create<ast::SintLiteral>(ctx->Clone(sint->source()),
+ ctx->Clone(sint->type()), val);
} else if (auto* uint = lit->As<ast::UintLiteral>()) {
uint32_t val = uint->value();
if (val >= size - 1) {
val = size - 1;
}
- lit = ctx->mod->create<ast::UintLiteral>(ctx->Clone(uint->type()), val);
+ lit = ctx->mod->create<ast::UintLiteral>(ctx->Clone(uint->source()),
+ ctx->Clone(uint->type()), val);
} else {
diag::Diagnostic err;
err.severity = diag::Severity::Error;
@@ -132,7 +134,7 @@
params.push_back(
ctx->mod->create<ast::TypeConstructorExpression>(u32, cast_expr));
params.push_back(ctx->mod->create<ast::ScalarConstructorExpression>(
- ctx->mod->create<ast::UintLiteral>(u32, size - 1)));
+ ctx->mod->create<ast::UintLiteral>(Source{}, u32, size - 1)));
auto* call_expr = ctx->mod->create<ast::CallExpression>(
ctx->mod->create<ast::IdentifierExpression>(
diff --git a/src/transform/emit_vertex_point_size.cc b/src/transform/emit_vertex_point_size.cc
index 1c53e05..ac07d6f 100644
--- a/src/transform/emit_vertex_point_size.cc
+++ b/src/transform/emit_vertex_point_size.cc
@@ -66,7 +66,7 @@
// Build the AST expression & statement for assigning pointsize one.
auto* one = mod->create<ast::ScalarConstructorExpression>(
- mod->create<ast::FloatLiteral>(f32, 1.0f));
+ mod->create<ast::FloatLiteral>(Source{}, f32, 1.0f));
auto* pointsize_ident = mod->create<ast::IdentifierExpression>(
Source{}, mod->RegisterSymbol(kPointSizeVar), kPointSizeVar);
auto* pointsize_assign =
diff --git a/src/transform/vertex_pulling.cc b/src/transform/vertex_pulling.cc
index 05fbae5..8fa3949 100644
--- a/src/transform/vertex_pulling.cc
+++ b/src/transform/vertex_pulling.cc
@@ -353,7 +353,7 @@
ast::Expression* VertexPulling::State::GenUint(uint32_t value) {
return mod->create<ast::ScalarConstructorExpression>(
- mod->create<ast::UintLiteral>(GetU32Type(), value));
+ mod->create<ast::UintLiteral>(Source{}, GetU32Type(), value));
}
ast::Expression* VertexPulling::State::CreatePullingPositionIdent() {
diff --git a/src/type_determiner_test.cc b/src/type_determiner_test.cc
index 1749a19..9386c1d 100644
--- a/src/type_determiner_test.cc
+++ b/src/type_determiner_test.cc
@@ -128,9 +128,9 @@
ast::type::I32 i32;
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.3f));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.3f));
ast::AssignmentStatement assign(lhs, rhs);
@@ -147,15 +147,15 @@
ast::type::F32 f32;
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.3f));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.3f));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(lhs, rhs));
ast::CaseSelectorList lit;
- lit.push_back(create<ast::SintLiteral>(&i32, 3));
+ lit.push_back(create<ast::SintLiteral>(Source{}, &i32, 3));
ast::CaseStatement cse(lit, body);
EXPECT_TRUE(td()->DetermineResultType(&cse));
@@ -170,9 +170,9 @@
ast::type::F32 f32;
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.3f));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.3f));
ast::BlockStatement block;
block.append(create<ast::AssignmentStatement>(lhs, rhs));
@@ -189,15 +189,15 @@
ast::type::F32 f32;
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.3f));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.3f));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(lhs, rhs));
ast::ElseStatement stmt(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)),
+ create<ast::SintLiteral>(Source{}, &i32, 3)),
body);
EXPECT_TRUE(td()->DetermineResultType(&stmt));
@@ -214,29 +214,29 @@
ast::type::F32 f32;
auto* else_lhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* else_rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.3f));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.3f));
auto* else_body = create<ast::BlockStatement>();
else_body->append(create<ast::AssignmentStatement>(else_lhs, else_rhs));
- auto* else_stmt =
- create<ast::ElseStatement>(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)),
- else_body);
+ auto* else_stmt = create<ast::ElseStatement>(
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(Source{}, &i32, 3)),
+ else_body);
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.3f));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.3f));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(lhs, rhs));
ast::IfStatement stmt(Source{},
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)),
+ create<ast::SintLiteral>(Source{}, &i32, 3)),
body, ast::ElseStatementList{else_stmt});
EXPECT_TRUE(td()->DetermineResultType(&stmt));
@@ -257,17 +257,17 @@
ast::type::F32 f32;
auto* body_lhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* body_rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.3f));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.3f));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(body_lhs, body_rhs));
auto* continuing_lhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* continuing_rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.3f));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.3f));
auto* continuing = create<ast::BlockStatement>();
continuing->append(
@@ -290,7 +290,7 @@
ast::type::I32 i32;
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
ast::ReturnStatement ret(Source{}, cond);
@@ -310,21 +310,21 @@
ast::type::F32 f32;
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.3f));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.3f));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(lhs, rhs));
ast::CaseSelectorList lit;
- lit.push_back(create<ast::SintLiteral>(&i32, 3));
+ lit.push_back(create<ast::SintLiteral>(Source{}, &i32, 3));
ast::CaseStatementList cases;
cases.push_back(create<ast::CaseStatement>(lit, body));
ast::SwitchStatement stmt(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)),
+ create<ast::SintLiteral>(Source{}, &i32, 2)),
cases);
EXPECT_TRUE(td()->DetermineResultType(&stmt)) << td()->error();
@@ -400,8 +400,8 @@
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* init = var->constructor();
ast::VariableDeclStatement decl(var);
@@ -420,8 +420,8 @@
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* init = var->constructor();
mod->AddGlobalVariable(var);
@@ -444,7 +444,7 @@
ast::type::Array ary(&f32, 3, ast::ArrayDecorationList{});
auto* idx = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* var =
create<ast::Variable>(Source{}, // source
"my_var", // name
@@ -476,7 +476,7 @@
ast::type::Alias aary(mod->RegisterSymbol("myarrty"), "myarrty", &ary);
auto* idx = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* var =
create<ast::Variable>(Source{}, // source
"my_var", // name
@@ -507,7 +507,7 @@
ast::type::Array ary(&f32, 3, ast::ArrayDecorationList{});
auto* idx = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* var =
create<ast::Variable>(Source{}, // source
"my_var", // name
@@ -536,7 +536,7 @@
ast::type::Matrix mat(&f32, 3, 2);
auto* idx = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* var =
create<ast::Variable>(Source{}, // source
"my_var", // name
@@ -568,9 +568,9 @@
ast::type::Matrix mat(&f32, 3, 2);
auto* idx1 = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* idx2 = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1));
+ create<ast::SintLiteral>(Source{}, &i32, 1));
auto* var =
create<ast::Variable>(Source{}, // source
"my_var", // name
@@ -605,7 +605,7 @@
ast::type::Vector vec(&f32, 3);
auto* idx = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* var =
create<ast::Variable>(Source{}, // source
"my_var", // name
@@ -680,7 +680,7 @@
ast::ExpressionList call_params;
call_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.4)));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.4)));
auto* param = call_params.back();
@@ -700,7 +700,7 @@
ast::ExpressionList call_params;
call_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.4)));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.4)));
ast::CallExpression call(
create<ast::IdentifierExpression>(mod->RegisterSymbol("round"), "round"),
@@ -730,7 +730,8 @@
TEST_F(TypeDeterminerTest, Expr_Constructor_Scalar) {
ast::type::F32 f32;
- ast::ScalarConstructorExpression s(create<ast::FloatLiteral>(&f32, 1.0f));
+ ast::ScalarConstructorExpression s(
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f));
EXPECT_TRUE(td()->DetermineResultType(&s));
ASSERT_NE(s.result_type(), nullptr);
@@ -743,11 +744,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::TypeConstructorExpression tc(&vec, vals);
@@ -1135,7 +1136,7 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("var"), "var"),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f))));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f))));
ast::VariableList params;
auto* func =
@@ -1365,7 +1366,7 @@
auto* foo_ident =
create<ast::IdentifierExpression>(mod->RegisterSymbol("foo"), "foo");
auto* idx = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 0));
+ create<ast::SintLiteral>(Source{}, &i32, 0));
auto* swizzle =
create<ast::IdentifierExpression>(mod->RegisterSymbol("yx"), "yx");
@@ -2933,7 +2934,7 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -2953,11 +2954,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
@@ -2980,7 +2981,7 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -3012,11 +3013,11 @@
ast::type::F32 f32;
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -3062,7 +3063,7 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -3082,11 +3083,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
@@ -3109,7 +3110,7 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, -11)));
+ create<ast::SintLiteral>(Source{}, &i32, -11)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -3129,11 +3130,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)));
+ create<ast::SintLiteral>(Source{}, &i32, 3)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
@@ -3156,7 +3157,7 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -3176,11 +3177,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1.0f)));
+ create<ast::UintLiteral>(Source{}, &u32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1.0f)));
+ create<ast::UintLiteral>(Source{}, &u32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 3.0f)));
+ create<ast::UintLiteral>(Source{}, &u32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
@@ -3203,7 +3204,7 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, false)));
+ create<ast::BoolLiteral>(Source{}, &bool_type, false)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -3235,11 +3236,11 @@
ast::type::F32 f32;
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -3260,7 +3261,7 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
ASSERT_TRUE(td()->DetermineResultType(params)) << td()->error();
@@ -3280,11 +3281,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
@@ -3304,7 +3305,7 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
auto* ident = create<ast::IdentifierExpression>(mod->RegisterSymbol("length"),
"length");
@@ -3332,11 +3333,11 @@
ast::type::F32 f32;
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(mod->RegisterSymbol("length"),
"length");
@@ -3355,9 +3356,9 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -3377,19 +3378,19 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
@@ -3413,9 +3414,9 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)));
+ create<ast::SintLiteral>(Source{}, &i32, 2)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -3447,7 +3448,7 @@
ast::type::F32 f32;
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -3467,17 +3468,17 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec2, vals_1));
@@ -3500,15 +3501,15 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
auto* ident = create<ast::IdentifierExpression>(
@@ -3526,11 +3527,11 @@
ast::type::F32 f32;
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -3554,9 +3555,9 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol("distance"), "distance");
@@ -3574,19 +3575,19 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
@@ -3607,9 +3608,9 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)));
+ create<ast::SintLiteral>(Source{}, &i32, 2)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol("distance"), "distance");
@@ -3637,7 +3638,7 @@
ast::type::F32 f32;
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol("distance"), "distance");
@@ -3655,17 +3656,17 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec2, vals_1));
@@ -3685,15 +3686,15 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
auto* ident = create<ast::IdentifierExpression>(
@@ -3708,11 +3709,11 @@
ast::type::F32 f32;
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol("distance"), "distance");
@@ -3729,19 +3730,19 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
@@ -3763,9 +3764,9 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
auto* ident =
create<ast::IdentifierExpression>(mod->RegisterSymbol("cross"), "cross");
@@ -3782,19 +3783,19 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)));
+ create<ast::SintLiteral>(Source{}, &i32, 3)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)));
+ create<ast::SintLiteral>(Source{}, &i32, 3)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
@@ -3826,11 +3827,11 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
@@ -3850,27 +3851,27 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList vals_3;
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
@@ -3894,11 +3895,11 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -3918,27 +3919,27 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList vals_3;
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
@@ -3963,11 +3964,11 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)));
+ create<ast::SintLiteral>(Source{}, &i32, 2)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)));
+ create<ast::SintLiteral>(Source{}, &i32, 3)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -3999,7 +4000,7 @@
ast::type::F32 f32;
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4016,9 +4017,9 @@
ast::type::F32 f32;
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4038,25 +4039,25 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList vals_3;
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec2, vals_1));
@@ -4080,17 +4081,17 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
auto* ident = create<ast::IdentifierExpression>(
@@ -4108,13 +4109,13 @@
ast::type::F32 f32;
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4143,11 +4144,11 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4167,27 +4168,27 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList vals_3;
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
@@ -4212,11 +4213,11 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4236,27 +4237,27 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)));
+ create<ast::SintLiteral>(Source{}, &i32, 3)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)));
+ create<ast::SintLiteral>(Source{}, &i32, 3)));
ast::ExpressionList vals_3;
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)));
+ create<ast::SintLiteral>(Source{}, &i32, 3)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
@@ -4281,11 +4282,11 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4305,27 +4306,27 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 3)));
+ create<ast::UintLiteral>(Source{}, &u32, 3)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 3)));
+ create<ast::UintLiteral>(Source{}, &u32, 3)));
ast::ExpressionList vals_3;
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 3)));
+ create<ast::UintLiteral>(Source{}, &u32, 3)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
@@ -4350,11 +4351,11 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true)));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, false)));
+ create<ast::BoolLiteral>(Source{}, &bool_type, false)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true)));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4386,7 +4387,7 @@
ast::type::F32 f32;
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4403,9 +4404,9 @@
ast::type::F32 f32;
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4425,25 +4426,25 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList vals_3;
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals_3.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec2, vals_1));
@@ -4467,17 +4468,17 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
auto* ident = create<ast::IdentifierExpression>(
@@ -4495,13 +4496,13 @@
ast::type::F32 f32;
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4526,7 +4527,7 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4546,11 +4547,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)));
+ create<ast::SintLiteral>(Source{}, &i32, 3)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
@@ -4573,7 +4574,7 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4605,11 +4606,11 @@
ast::type::I32 i32;
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4636,9 +4637,9 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4657,9 +4658,9 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4678,9 +4679,9 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4700,19 +4701,19 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)));
+ create<ast::SintLiteral>(Source{}, &i32, 3)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)));
+ create<ast::SintLiteral>(Source{}, &i32, 3)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
@@ -4737,19 +4738,19 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 3)));
+ create<ast::UintLiteral>(Source{}, &u32, 3)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 3)));
+ create<ast::UintLiteral>(Source{}, &u32, 3)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
@@ -4774,19 +4775,19 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals_1));
@@ -4810,9 +4811,9 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true)));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, false)));
+ create<ast::BoolLiteral>(Source{}, &bool_type, false)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4844,7 +4845,7 @@
ast::type::I32 i32;
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
@@ -4864,17 +4865,17 @@
ast::ExpressionList vals_1;
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_1.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
ast::ExpressionList vals_2;
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals_2.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)));
+ create<ast::SintLiteral>(Source{}, &i32, 3)));
ast::ExpressionList params;
params.push_back(create<ast::TypeConstructorExpression>(&vec2, vals_1));
@@ -4897,15 +4898,15 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)));
+ create<ast::SintLiteral>(Source{}, &i32, 3)));
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
params.push_back(create<ast::TypeConstructorExpression>(&vec, vals));
auto* ident = create<ast::IdentifierExpression>(
@@ -4923,11 +4924,11 @@
ast::type::I32 i32;
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
auto* ident = create<ast::IdentifierExpression>(
mod->RegisterSymbol(param.name), param.name);
diff --git a/src/validator/validator_control_block_test.cc b/src/validator/validator_control_block_test.cc
index e60af3d..087ba48 100644
--- a/src/validator/validator_control_block_test.cc
+++ b/src/validator/validator_control_block_test.cc
@@ -50,8 +50,8 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&f32, 3.14f)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &f32, 3.14f)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* cond = create<ast::IdentifierExpression>(
Source{Source::Location{12, 34}}, mod()->RegisterSymbol("a"), "a");
@@ -84,13 +84,13 @@
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
ast::CaseSelectorList csl;
- csl.push_back(create<ast::SintLiteral>(&i32, 1));
+ csl.push_back(create<ast::SintLiteral>(Source{}, &i32, 1));
ast::CaseStatementList body;
body.push_back(
create<ast::CaseStatement>(csl, create<ast::BlockStatement>()));
@@ -122,8 +122,8 @@
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
ast::CaseStatementList switch_body;
auto* cond =
@@ -135,7 +135,7 @@
create<ast::CaseStatement>(default_csl_1, block_default_1));
ast::CaseSelectorList csl_case_1;
- csl_case_1.push_back(create<ast::SintLiteral>(&i32, 1));
+ csl_case_1.push_back(create<ast::SintLiteral>(Source{}, &i32, 1));
auto* block_case_1 = create<ast::BlockStatement>();
switch_body.push_back(create<ast::CaseStatement>(csl_case_1, block_case_1));
@@ -172,15 +172,15 @@
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
ast::CaseStatementList switch_body;
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
ast::CaseSelectorList csl;
- csl.push_back(create<ast::UintLiteral>(&u32, 1));
+ csl.push_back(create<ast::UintLiteral>(Source{}, &u32, 1));
switch_body.push_back(create<ast::CaseStatement>(
Source{Source::Location{12, 34}}, csl, create<ast::BlockStatement>()));
@@ -215,15 +215,15 @@
&u32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::UintLiteral>(Source{}, &u32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
ast::CaseStatementList switch_body;
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
ast::CaseSelectorList csl;
- csl.push_back(create<ast::SintLiteral>(&i32, -1));
+ csl.push_back(create<ast::SintLiteral>(Source{}, &i32, -1));
switch_body.push_back(create<ast::CaseStatement>(
Source{Source::Location{12, 34}}, csl, create<ast::BlockStatement>()));
@@ -257,21 +257,21 @@
&u32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 3)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::UintLiteral>(Source{}, &u32, 3)), // constructor
+ ast::VariableDecorationList{}); // decorations
ast::CaseStatementList switch_body;
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
ast::CaseSelectorList csl_1;
- csl_1.push_back(create<ast::UintLiteral>(&u32, 0));
+ csl_1.push_back(create<ast::UintLiteral>(Source{}, &u32, 0));
switch_body.push_back(
create<ast::CaseStatement>(csl_1, create<ast::BlockStatement>()));
ast::CaseSelectorList csl_2;
- csl_2.push_back(create<ast::UintLiteral>(&u32, 2));
- csl_2.push_back(create<ast::UintLiteral>(&u32, 2));
+ csl_2.push_back(create<ast::UintLiteral>(Source{}, &u32, 2));
+ csl_2.push_back(create<ast::UintLiteral>(Source{}, &u32, 2));
switch_body.push_back(create<ast::CaseStatement>(
Source{Source::Location{12, 34}}, csl_2, create<ast::BlockStatement>()));
@@ -305,23 +305,23 @@
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
ast::CaseStatementList switch_body;
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
ast::CaseSelectorList csl_1;
- csl_1.push_back(create<ast::SintLiteral>(&i32, 10));
+ csl_1.push_back(create<ast::SintLiteral>(Source{}, &i32, 10));
switch_body.push_back(
create<ast::CaseStatement>(csl_1, create<ast::BlockStatement>()));
ast::CaseSelectorList csl_2;
- csl_2.push_back(create<ast::SintLiteral>(&i32, 0));
- csl_2.push_back(create<ast::SintLiteral>(&i32, 1));
- csl_2.push_back(create<ast::SintLiteral>(&i32, 2));
- csl_2.push_back(create<ast::SintLiteral>(&i32, 10));
+ csl_2.push_back(create<ast::SintLiteral>(Source{}, &i32, 0));
+ csl_2.push_back(create<ast::SintLiteral>(Source{}, &i32, 1));
+ csl_2.push_back(create<ast::SintLiteral>(Source{}, &i32, 2));
+ csl_2.push_back(create<ast::SintLiteral>(Source{}, &i32, 10));
switch_body.push_back(create<ast::CaseStatement>(
Source{Source::Location{12, 34}}, csl_2, create<ast::BlockStatement>()));
@@ -353,8 +353,8 @@
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
@@ -390,8 +390,8 @@
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
@@ -401,7 +401,7 @@
body.push_back(create<ast::CaseStatement>(Source{Source::Location{12, 34}},
default_csl, block_default));
ast::CaseSelectorList case_csl;
- case_csl.push_back(create<ast::SintLiteral>(&i32, 5));
+ case_csl.push_back(create<ast::SintLiteral>(Source{}, &i32, 5));
auto* block_case = create<ast::BlockStatement>();
body.push_back(create<ast::CaseStatement>(case_csl, block_case));
@@ -430,8 +430,8 @@
&my_int, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&u32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &u32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
diff --git a/src/validator/validator_function_test.cc b/src/validator/validator_function_test.cc
index 8440faa..b581bcb 100644
--- a/src/validator/validator_function_test.cc
+++ b/src/validator/validator_function_test.cc
@@ -46,8 +46,8 @@
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
ast::VariableList params;
ast::type::Void void_type;
@@ -94,8 +94,8 @@
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
ast::VariableList params;
ast::type::Void void_type;
@@ -155,7 +155,7 @@
ast::VariableList params;
auto* body = create<ast::BlockStatement>();
auto* return_expr = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
body->append(create<ast::ReturnStatement>(Source{Source::Location{12, 34}},
return_expr));
@@ -179,7 +179,7 @@
ast::VariableList params;
auto* body = create<ast::BlockStatement>();
auto* return_expr = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
body->append(create<ast::ReturnStatement>(Source{Source::Location{12, 34}},
return_expr));
@@ -205,7 +205,7 @@
ast::VariableList params;
auto* body = create<ast::BlockStatement>();
auto* return_expr = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
body->append(create<ast::ReturnStatement>(Source{}, return_expr));
auto* func =
@@ -215,7 +215,7 @@
ast::VariableList params_copy;
auto* body_copy = create<ast::BlockStatement>();
auto* return_expr_copy = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
body_copy->append(create<ast::ReturnStatement>(Source{}, return_expr_copy));
auto* func_copy = create<ast::Function>(
@@ -274,7 +274,7 @@
auto* body0 = create<ast::BlockStatement>();
body0->append(create<ast::VariableDeclStatement>(var));
auto* return_expr = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
body0->append(create<ast::ReturnStatement>(Source{}, return_expr));
auto* func0 = create<ast::Function>(Source{}, mod()->RegisterSymbol("func"),
@@ -293,7 +293,7 @@
ast::type::I32 i32;
ast::VariableList params;
auto* return_expr = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 0));
+ create<ast::SintLiteral>(Source{}, &i32, 0));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>(Source{}, return_expr));
diff --git a/src/validator/validator_test.cc b/src/validator/validator_test.cc
index 9c5c5d3..982f4e5 100644
--- a/src/validator/validator_test.cc
+++ b/src/validator/validator_test.cc
@@ -65,7 +65,7 @@
ast::type::I32 i32;
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1));
+ create<ast::SintLiteral>(Source{}, &i32, 1));
auto* rhs = create<ast::IdentifierExpression>(mod()->RegisterSymbol("my_var"),
"my_var");
ast::AssignmentStatement assign(Source{Source::Location{12, 34}}, lhs, rhs);
@@ -83,7 +83,7 @@
auto* lhs = create<ast::IdentifierExpression>(
Source{Source::Location{12, 34}}, mod()->RegisterSymbol("b"), "b");
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* assign = create<ast::AssignmentStatement>(
Source{Source::Location{12, 34}}, lhs, rhs);
@@ -101,7 +101,7 @@
auto* lhs = create<ast::IdentifierExpression>(
Source{Source::Location{12, 34}}, mod()->RegisterSymbol("b"), "b");
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
@@ -123,13 +123,13 @@
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* lhs =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
ast::AssignmentStatement assign(Source{Source::Location{12, 34}}, lhs, rhs);
td()->RegisterVariableForTesting(var);
@@ -154,13 +154,13 @@
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* lhs =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.3f));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.3f));
ast::AssignmentStatement assign(Source{Source::Location{12, 34}}, lhs, rhs);
td()->RegisterVariableForTesting(var);
@@ -188,13 +188,13 @@
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* lhs =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::VariableDeclStatement>(var));
@@ -223,12 +223,12 @@
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* lhs =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.3f));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.3f));
ast::BlockStatement block;
block.append(create<ast::VariableDeclStatement>(var));
@@ -324,14 +324,14 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.1)), // constructor
- ast::VariableDecorationList{})); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 2.1)), // constructor
+ ast::VariableDecorationList{})); // decorations
auto* lhs = create<ast::IdentifierExpression>(
Source{Source::Location{12, 34}}, mod()->RegisterSymbol("not_global_var"),
"not_global_var");
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.14f));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.14f));
ast::VariableList params;
auto* body = create<ast::BlockStatement>();
@@ -363,13 +363,13 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.1)), // constructor
- ast::VariableDecorationList{})); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 2.1)), // constructor
+ ast::VariableDecorationList{})); // decorations
auto* lhs = create<ast::IdentifierExpression>(
mod()->RegisterSymbol("global_var"), "global_var");
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.14f));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.14f));
ast::VariableList params;
@@ -402,19 +402,19 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 2.0)), // constructor
+ ast::VariableDecorationList{}); // decorations
ast::type::Bool bool_type;
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::VariableDeclStatement>(var));
auto* lhs = create<ast::IdentifierExpression>(
Source{Source::Location{12, 34}}, mod()->RegisterSymbol("a"), "a");
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.14f));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.14f));
auto* outer_body = create<ast::BlockStatement>();
outer_body->append(
@@ -442,17 +442,17 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 2.0)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* lhs = create<ast::IdentifierExpression>(
Source{Source::Location{12, 34}}, mod()->RegisterSymbol("a"), "a");
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.14f));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.14f));
ast::type::Bool bool_type;
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
Source{Source::Location{12, 34}}, lhs, rhs));
@@ -479,8 +479,8 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 0.1)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 0.1)), // constructor
+ ast::VariableDecorationList{}); // decorations
mod()->AddGlobalVariable(var0);
auto* var1 = create<ast::Variable>(
@@ -490,8 +490,8 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 0)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 0)), // constructor
+ ast::VariableDecorationList{}); // decorations
mod()->AddGlobalVariable(var1);
EXPECT_TRUE(v()->ValidateGlobalVariables(mod()->global_variables()))
@@ -510,8 +510,8 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 0.1)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 0.1)), // constructor
+ ast::VariableDecorationList{}); // decorations
mod()->AddGlobalVariable(var0);
auto* var1 = create<ast::Variable>(
@@ -521,8 +521,8 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 0)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 0)), // constructor
+ ast::VariableDecorationList{}); // decorations
mod()->AddGlobalVariable(var1);
EXPECT_FALSE(v()->ValidateGlobalVariables(mod()->global_variables()));
@@ -543,13 +543,13 @@
&i32, // type
true, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* lhs =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::VariableDeclStatement>(var));
@@ -580,8 +580,8 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.1)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 2.1)), // constructor
+ ast::VariableDecorationList{}); // decorations
mod()->AddGlobalVariable(global_var);
auto* var = create<ast::Variable>(
@@ -591,8 +591,8 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 2.0)), // constructor
+ ast::VariableDecorationList{}); // decorations
ast::VariableList params;
auto* body = create<ast::BlockStatement>();
body->append(create<ast::VariableDeclStatement>(
@@ -624,8 +624,8 @@
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* var_a_float = create<ast::Variable>(
Source{}, // source
@@ -634,8 +634,8 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 0.1)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 0.1)), // constructor
+ ast::VariableDecorationList{}); // decorations
ast::VariableList params;
auto* body = create<ast::BlockStatement>();
@@ -667,12 +667,12 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 2.0)), // constructor
+ ast::VariableDecorationList{}); // decorations
ast::type::Bool bool_type;
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::VariableDeclStatement>(var));
@@ -683,8 +683,8 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.14)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 3.14)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* outer_body = create<ast::BlockStatement>();
outer_body->append(
@@ -711,8 +711,8 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.14)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 3.14)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* var = create<ast::Variable>(
Source{}, // source
@@ -721,12 +721,12 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 2.0)), // constructor
+ ast::VariableDecorationList{}); // decorations
ast::type::Bool bool_type;
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::VariableDeclStatement>(
Source{Source::Location{12, 34}}, var));
@@ -753,8 +753,8 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 2.0)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* var1 = create<ast::Variable>(
Source{}, // source
@@ -763,8 +763,8 @@
&void_type, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0)), // constructor
+ ast::VariableDecorationList{}); // decorations
ast::VariableList params0;
auto* body0 = create<ast::BlockStatement>();
@@ -813,7 +813,7 @@
auto* lhs =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
auto* body = create<ast::BlockStatement>();
body->append(create<ast::VariableDeclStatement>(var));
diff --git a/src/writer/hlsl/generator_impl.cc b/src/writer/hlsl/generator_impl.cc
index fa49a4b..209f94a 100644
--- a/src/writer/hlsl/generator_impl.cc
+++ b/src/writer/hlsl/generator_impl.cc
@@ -779,7 +779,7 @@
auto emit_vector_appended_with_i32_zero = [&](tint::ast::Expression* vector) {
auto* i32 = module_->create<ast::type::I32>();
- ast::SintLiteral zero_lit(i32, 0);
+ ast::SintLiteral zero_lit(Source{}, i32, 0);
ast::ScalarConstructorExpression zero(&zero_lit);
zero.set_result_type(i32);
return AppendVector(vector, &zero,
diff --git a/src/writer/hlsl/generator_impl_array_accessor_test.cc b/src/writer/hlsl/generator_impl_array_accessor_test.cc
index ddf140c..d0a6885 100644
--- a/src/writer/hlsl/generator_impl_array_accessor_test.cc
+++ b/src/writer/hlsl/generator_impl_array_accessor_test.cc
@@ -31,7 +31,7 @@
TEST_F(HlslGeneratorImplTest_Expression, EmitExpression_ArrayAccessor) {
ast::type::I32 i32;
- auto* lit = create<ast::SintLiteral>(&i32, 5);
+ auto* lit = create<ast::SintLiteral>(Source{}, &i32, 5);
auto* idx = create<ast::ScalarConstructorExpression>(lit);
auto* ary =
create<ast::IdentifierExpression>(mod.RegisterSymbol("ary"), "ary");
diff --git a/src/writer/hlsl/generator_impl_binary_test.cc b/src/writer/hlsl/generator_impl_binary_test.cc
index 106d279..5ab8160 100644
--- a/src/writer/hlsl/generator_impl_binary_test.cc
+++ b/src/writer/hlsl/generator_impl_binary_test.cc
@@ -193,15 +193,15 @@
auto* lhs = create<ast::TypeConstructorExpression>(
&vec3, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
});
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f));
ast::BinaryExpression expr(ast::BinaryOp::kMultiply, lhs, rhs);
@@ -217,15 +217,15 @@
ast::type::Vector vec3(&f32, 3);
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f));
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* rhs = create<ast::TypeConstructorExpression>(&vec3, vals);
ast::BinaryExpression expr(ast::BinaryOp::kMultiply, lhs, rhs);
@@ -252,7 +252,7 @@
auto* lhs =
create<ast::IdentifierExpression>(mod.RegisterSymbol("mat"), "mat");
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f));
td.RegisterVariableForTesting(var);
@@ -276,7 +276,7 @@
nullptr, // constructor
ast::VariableDecorationList{}); // decorations
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f));
auto* rhs =
create<ast::IdentifierExpression>(mod.RegisterSymbol("mat"), "mat");
@@ -307,11 +307,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* rhs = create<ast::TypeConstructorExpression>(&vec3, vals);
td.RegisterVariableForTesting(var);
@@ -339,11 +339,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* lhs = create<ast::TypeConstructorExpression>(&vec3, vals);
auto* rhs =
@@ -462,13 +462,13 @@
auto* body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>(
Source{}, create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3))));
+ create<ast::SintLiteral>(Source{}, &i32, 3))));
auto* else_stmt = create<ast::ElseStatement>(body);
body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>(
Source{}, create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))));
+ create<ast::SintLiteral>(Source{}, &i32, 2))));
auto* else_if_stmt = create<ast::ElseStatement>(
create<ast::BinaryExpression>(
ast::BinaryOp::kLogicalOr,
@@ -479,7 +479,7 @@
body = create<ast::BlockStatement>();
body->append(create<ast::ReturnStatement>(
Source{}, create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1))));
+ create<ast::SintLiteral>(Source{}, &i32, 1))));
ast::IfStatement expr(
Source{},
diff --git a/src/writer/hlsl/generator_impl_case_test.cc b/src/writer/hlsl/generator_impl_case_test.cc
index 0efe976..c6117bb 100644
--- a/src/writer/hlsl/generator_impl_case_test.cc
+++ b/src/writer/hlsl/generator_impl_case_test.cc
@@ -37,7 +37,7 @@
body->append(create<ast::BreakStatement>());
ast::CaseSelectorList lit;
- lit.push_back(create<ast::SintLiteral>(&i32, 5));
+ lit.push_back(create<ast::SintLiteral>(Source{}, &i32, 5));
ast::CaseStatement c(lit, body);
gen.increment_indent();
@@ -53,7 +53,7 @@
ast::type::I32 i32;
ast::CaseSelectorList lit;
- lit.push_back(create<ast::SintLiteral>(&i32, 5));
+ lit.push_back(create<ast::SintLiteral>(Source{}, &i32, 5));
ast::CaseStatement c(lit, create<ast::BlockStatement>());
gen.increment_indent();
@@ -72,7 +72,7 @@
body->append(create<ast::FallthroughStatement>());
ast::CaseSelectorList lit;
- lit.push_back(create<ast::SintLiteral>(&i32, 5));
+ lit.push_back(create<ast::SintLiteral>(Source{}, &i32, 5));
ast::CaseStatement c(lit, body);
gen.increment_indent();
@@ -91,8 +91,8 @@
body->append(create<ast::BreakStatement>());
ast::CaseSelectorList lit;
- lit.push_back(create<ast::SintLiteral>(&i32, 5));
- lit.push_back(create<ast::SintLiteral>(&i32, 6));
+ lit.push_back(create<ast::SintLiteral>(Source{}, &i32, 5));
+ lit.push_back(create<ast::SintLiteral>(Source{}, &i32, 6));
ast::CaseStatement c(lit, body);
gen.increment_indent();
diff --git a/src/writer/hlsl/generator_impl_constructor_test.cc b/src/writer/hlsl/generator_impl_constructor_test.cc
index 3bbdbc7..0cb4ba0 100644
--- a/src/writer/hlsl/generator_impl_constructor_test.cc
+++ b/src/writer/hlsl/generator_impl_constructor_test.cc
@@ -37,7 +37,7 @@
TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Bool) {
ast::type::Bool bool_type;
- auto* lit = create<ast::BoolLiteral>(&bool_type, false);
+ auto* lit = create<ast::BoolLiteral>(Source{}, &bool_type, false);
ast::ScalarConstructorExpression expr(lit);
ASSERT_TRUE(gen.EmitConstructor(pre, out, &expr)) << gen.error();
@@ -46,7 +46,7 @@
TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Int) {
ast::type::I32 i32;
- auto* lit = create<ast::SintLiteral>(&i32, -12345);
+ auto* lit = create<ast::SintLiteral>(Source{}, &i32, -12345);
ast::ScalarConstructorExpression expr(lit);
ASSERT_TRUE(gen.EmitConstructor(pre, out, &expr)) << gen.error();
@@ -55,7 +55,7 @@
TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_UInt) {
ast::type::U32 u32;
- auto* lit = create<ast::UintLiteral>(&u32, 56779);
+ auto* lit = create<ast::UintLiteral>(Source{}, &u32, 56779);
ast::ScalarConstructorExpression expr(lit);
ASSERT_TRUE(gen.EmitConstructor(pre, out, &expr)) << gen.error();
@@ -65,8 +65,8 @@
TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Float) {
ast::type::F32 f32;
// Use a number close to 1<<30 but whose decimal representation ends in 0.
- auto* lit =
- create<ast::FloatLiteral>(&f32, static_cast<float>((1 << 30) - 4));
+ auto* lit = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>((1 << 30) - 4));
ast::ScalarConstructorExpression expr(lit);
ASSERT_TRUE(gen.EmitConstructor(pre, out, &expr)) << gen.error();
@@ -76,7 +76,7 @@
TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Float) {
ast::type::F32 f32;
- auto* lit = create<ast::FloatLiteral>(&f32, -1.2e-5);
+ auto* lit = create<ast::FloatLiteral>(Source{}, &f32, -1.2e-5);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit));
@@ -89,7 +89,7 @@
TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Bool) {
ast::type::Bool b;
- auto* lit = create<ast::BoolLiteral>(&b, true);
+ auto* lit = create<ast::BoolLiteral>(Source{}, &b, true);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit));
@@ -102,7 +102,7 @@
TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Int) {
ast::type::I32 i32;
- auto* lit = create<ast::SintLiteral>(&i32, -12345);
+ auto* lit = create<ast::SintLiteral>(Source{}, &i32, -12345);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit));
@@ -115,7 +115,7 @@
TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Uint) {
ast::type::U32 u32;
- auto* lit = create<ast::UintLiteral>(&u32, 12345);
+ auto* lit = create<ast::UintLiteral>(Source{}, &u32, 12345);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit));
@@ -129,9 +129,9 @@
ast::type::F32 f32;
ast::type::Vector vec(&f32, 3);
- auto* lit1 = create<ast::FloatLiteral>(&f32, 1.f);
- auto* lit2 = create<ast::FloatLiteral>(&f32, 2.f);
- auto* lit3 = create<ast::FloatLiteral>(&f32, 3.f);
+ auto* lit1 = create<ast::FloatLiteral>(Source{}, &f32, 1.f);
+ auto* lit2 = create<ast::FloatLiteral>(Source{}, &f32, 2.f);
+ auto* lit3 = create<ast::FloatLiteral>(Source{}, &f32, 3.f);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit1));
values.push_back(create<ast::ScalarConstructorExpression>(lit2));
@@ -165,12 +165,12 @@
ast::ExpressionList mat_values;
for (size_t i = 0; i < 2; i++) {
- auto* lit1 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(1 + (i * 2)));
- auto* lit2 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(2 + (i * 2)));
- auto* lit3 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(3 + (i * 2)));
+ auto* lit1 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(1 + (i * 2)));
+ auto* lit2 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(2 + (i * 2)));
+ auto* lit3 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(3 + (i * 2)));
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit1));
@@ -198,12 +198,12 @@
ast::ExpressionList ary_values;
for (size_t i = 0; i < 3; i++) {
- auto* lit1 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(1 + (i * 3)));
- auto* lit2 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(2 + (i * 3)));
- auto* lit3 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(3 + (i * 3)));
+ auto* lit1 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(1 + (i * 3)));
+ auto* lit2 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(2 + (i * 3)));
+ auto* lit3 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(3 + (i * 3)));
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit1));
diff --git a/src/writer/hlsl/generator_impl_function_test.cc b/src/writer/hlsl/generator_impl_function_test.cc
index f05f0f7..ff3bd55 100644
--- a/src/writer/hlsl/generator_impl_function_test.cc
+++ b/src/writer/hlsl/generator_impl_function_test.cc
@@ -606,7 +606,7 @@
"coord"),
create<ast::IdentifierExpression>(mod.RegisterSymbol("b"), "b")),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.0f)));
auto* body = create<ast::BlockStatement>();
body->append(assign);
@@ -710,7 +710,7 @@
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
@@ -798,7 +798,7 @@
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
@@ -900,7 +900,7 @@
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
@@ -990,7 +990,7 @@
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
auto* var =
create<ast::Variable>(Source{}, // source
@@ -1082,7 +1082,7 @@
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
auto* var =
create<ast::Variable>(Source{}, // source
@@ -1150,18 +1150,19 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod.RegisterSymbol("bar"), "bar"),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f))));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f))));
auto* list = create<ast::BlockStatement>();
list->append(create<ast::ReturnStatement>(Source{}));
body->append(create<ast::IfStatement>(
Source{},
- create<ast::BinaryExpression>(ast::BinaryOp::kEqual,
- create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
- create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1))),
+ create<ast::BinaryExpression>(
+ ast::BinaryOp::kEqual,
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(Source{}, &i32, 1))),
list, ast::ElseStatementList{}));
body->append(create<ast::ReturnStatement>(Source{}));
diff --git a/src/writer/hlsl/generator_impl_import_test.cc b/src/writer/hlsl/generator_impl_import_test.cc
index de3e4b5..47b1ec2 100644
--- a/src/writer/hlsl/generator_impl_import_test.cc
+++ b/src/writer/hlsl/generator_impl_import_test.cc
@@ -54,7 +54,7 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod.RegisterSymbol(param.name), param.name);
@@ -100,7 +100,7 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
ast::CallExpression expr(create<ast::IdentifierExpression>(
mod.RegisterSymbol(param.name), param.name),
@@ -122,9 +122,9 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.f)));
ast::CallExpression expr(create<ast::IdentifierExpression>(
mod.RegisterSymbol(param.name), param.name),
@@ -155,21 +155,21 @@
params.push_back(create<ast::TypeConstructorExpression>(
&vec, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 2.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 3.f)),
}));
params.push_back(create<ast::TypeConstructorExpression>(
&vec, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 4.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 4.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 5.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 5.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 6.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 6.f)),
}));
ast::CallExpression expr(create<ast::IdentifierExpression>(
@@ -194,9 +194,9 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)));
+ create<ast::SintLiteral>(Source{}, &i32, 2)));
ast::CallExpression expr(create<ast::IdentifierExpression>(
mod.RegisterSymbol(param.name), param.name),
@@ -219,11 +219,11 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.f)));
ast::CallExpression expr(create<ast::IdentifierExpression>(
mod.RegisterSymbol(param.name), param.name),
@@ -253,11 +253,11 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)));
+ create<ast::SintLiteral>(Source{}, &i32, 2)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)));
+ create<ast::SintLiteral>(Source{}, &i32, 3)));
ast::CallExpression expr(create<ast::IdentifierExpression>(
mod.RegisterSymbol(param.name), param.name),
diff --git a/src/writer/hlsl/generator_impl_loop_test.cc b/src/writer/hlsl/generator_impl_loop_test.cc
index b06f1bc..25b4a63 100644
--- a/src/writer/hlsl/generator_impl_loop_test.cc
+++ b/src/writer/hlsl/generator_impl_loop_test.cc
@@ -153,8 +153,8 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.4)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 2.4)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* body = create<ast::BlockStatement>();
body->append(create<ast::VariableDeclStatement>(var));
diff --git a/src/writer/hlsl/generator_impl_member_accessor_test.cc b/src/writer/hlsl/generator_impl_member_accessor_test.cc
index 8bbc18e..055b679 100644
--- a/src/writer/hlsl/generator_impl_member_accessor_test.cc
+++ b/src/writer/hlsl/generator_impl_member_accessor_test.cc
@@ -519,9 +519,9 @@
"data"),
create<ast::IdentifierExpression>(mod.RegisterSymbol("a"), "a")),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))),
+ create<ast::SintLiteral>(Source{}, &i32, 2))),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
td.RegisterVariableForTesting(coord_var);
gen.register_global(coord_var);
@@ -573,7 +573,7 @@
create<ast::IdentifierExpression>(mod.RegisterSymbol("data"), "data"),
create<ast::IdentifierExpression>(mod.RegisterSymbol("a"), "a")),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)));
+ create<ast::SintLiteral>(Source{}, &i32, 2)));
td.RegisterVariableForTesting(coord_var);
gen.register_global(coord_var);
@@ -629,11 +629,11 @@
create<ast::BinaryExpression>(
ast::BinaryOp::kAdd,
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)),
+ create<ast::SintLiteral>(Source{}, &i32, 2)),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 4))),
+ create<ast::SintLiteral>(Source{}, &i32, 4))),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3))));
+ create<ast::SintLiteral>(Source{}, &i32, 3))));
td.RegisterVariableForTesting(coord_var);
gen.register_global(coord_var);
@@ -692,7 +692,7 @@
create<ast::IdentifierExpression>(mod.RegisterSymbol("data"), "data"),
create<ast::IdentifierExpression>(mod.RegisterSymbol("b"), "b"));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0f));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.0f));
ast::AssignmentStatement assign(lhs, rhs);
ASSERT_TRUE(td.DetermineResultType(&assign));
@@ -747,9 +747,9 @@
create<ast::IdentifierExpression>(mod.RegisterSymbol("data"), "data"),
create<ast::IdentifierExpression>(mod.RegisterSymbol("a"), "a")),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)));
+ create<ast::SintLiteral>(Source{}, &i32, 2)));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
ast::AssignmentStatement assign(lhs, rhs);
ASSERT_TRUE(td.DetermineResultType(&assign)) << td.error();
@@ -804,7 +804,7 @@
create<ast::IdentifierExpression>(mod.RegisterSymbol("data"), "data"),
create<ast::IdentifierExpression>(mod.RegisterSymbol("a"), "a"));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2));
+ create<ast::SintLiteral>(Source{}, &i32, 2));
ast::AssignmentStatement assign(lhs, rhs);
ASSERT_TRUE(td.DetermineResultType(&assign));
@@ -910,9 +910,9 @@
ASSERT_TRUE(td.Determine()) << td.error();
- auto* lit1 = create<ast::FloatLiteral>(&f32, 1.f);
- auto* lit2 = create<ast::FloatLiteral>(&f32, 2.f);
- auto* lit3 = create<ast::FloatLiteral>(&f32, 3.f);
+ auto* lit1 = create<ast::FloatLiteral>(Source{}, &f32, 1.f);
+ auto* lit2 = create<ast::FloatLiteral>(Source{}, &f32, 2.f);
+ auto* lit3 = create<ast::FloatLiteral>(Source{}, &f32, 3.f);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit1));
values.push_back(create<ast::ScalarConstructorExpression>(lit2));
@@ -1001,7 +1001,7 @@
"data"),
create<ast::IdentifierExpression>(mod.RegisterSymbol("c"), "c")),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))),
+ create<ast::SintLiteral>(Source{}, &i32, 2))),
create<ast::IdentifierExpression>(mod.RegisterSymbol("b"), "b"));
ASSERT_TRUE(td.DetermineResultType(&expr));
@@ -1081,7 +1081,7 @@
create<ast::IdentifierExpression>(mod.RegisterSymbol("c"),
"c")),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))),
+ create<ast::SintLiteral>(Source{}, &i32, 2))),
create<ast::IdentifierExpression>(mod.RegisterSymbol("b"), "b")),
create<ast::IdentifierExpression>(mod.RegisterSymbol("xy"), "xy"));
@@ -1161,7 +1161,7 @@
create<ast::IdentifierExpression>(mod.RegisterSymbol("c"),
"c")),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))),
+ create<ast::SintLiteral>(Source{}, &i32, 2))),
create<ast::IdentifierExpression>(mod.RegisterSymbol("b"), "b")),
create<ast::IdentifierExpression>(mod.RegisterSymbol("g"), "g"));
@@ -1240,10 +1240,10 @@
create<ast::IdentifierExpression>(mod.RegisterSymbol("c"),
"c")),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))),
+ create<ast::SintLiteral>(Source{}, &i32, 2))),
create<ast::IdentifierExpression>(mod.RegisterSymbol("b"), "b")),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
ASSERT_TRUE(td.DetermineResultType(&expr));
ASSERT_TRUE(gen.EmitExpression(pre, out, &expr)) << gen.error();
@@ -1318,12 +1318,12 @@
"data"),
create<ast::IdentifierExpression>(mod.RegisterSymbol("c"), "c")),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))),
+ create<ast::SintLiteral>(Source{}, &i32, 2))),
create<ast::IdentifierExpression>(mod.RegisterSymbol("b"), "b"));
- auto* lit1 = create<ast::FloatLiteral>(&f32, 1.f);
- auto* lit2 = create<ast::FloatLiteral>(&f32, 2.f);
- auto* lit3 = create<ast::FloatLiteral>(&f32, 3.f);
+ auto* lit1 = create<ast::FloatLiteral>(Source{}, &f32, 1.f);
+ auto* lit2 = create<ast::FloatLiteral>(Source{}, &f32, 2.f);
+ auto* lit3 = create<ast::FloatLiteral>(Source{}, &f32, 3.f);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit1));
values.push_back(create<ast::ScalarConstructorExpression>(lit2));
@@ -1410,12 +1410,12 @@
create<ast::IdentifierExpression>(mod.RegisterSymbol("c"),
"c")),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))),
+ create<ast::SintLiteral>(Source{}, &i32, 2))),
create<ast::IdentifierExpression>(mod.RegisterSymbol("b"), "b")),
create<ast::IdentifierExpression>(mod.RegisterSymbol("y"), "y"));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&i32, 1.f));
+ create<ast::FloatLiteral>(Source{}, &i32, 1.f));
ast::AssignmentStatement assign(lhs, rhs);
diff --git a/src/writer/hlsl/generator_impl_module_constant_test.cc b/src/writer/hlsl/generator_impl_module_constant_test.cc
index c98882f..cae5bd3 100644
--- a/src/writer/hlsl/generator_impl_module_constant_test.cc
+++ b/src/writer/hlsl/generator_impl_module_constant_test.cc
@@ -38,11 +38,11 @@
ast::ExpressionList exprs;
exprs.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
exprs.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.0f)));
exprs.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
auto* var = create<ast::Variable>(
Source{}, // source
@@ -67,7 +67,7 @@
&f32, // type
true, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)), // constructor
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)), // constructor
ast::VariableDecorationList{
// decorations
create<ast::ConstantIdDecoration>(23, Source{}),
diff --git a/src/writer/hlsl/generator_impl_switch_test.cc b/src/writer/hlsl/generator_impl_switch_test.cc
index 7e8ef38..9456dff 100644
--- a/src/writer/hlsl/generator_impl_switch_test.cc
+++ b/src/writer/hlsl/generator_impl_switch_test.cc
@@ -37,7 +37,7 @@
ast::type::I32 i32;
ast::CaseSelectorList case_val;
- case_val.push_back(create<ast::SintLiteral>(&i32, 5));
+ case_val.push_back(create<ast::SintLiteral>(Source{}, &i32, 5));
auto* case_body = create<ast::BlockStatement>();
case_body->append(create<ast::BreakStatement>());
diff --git a/src/writer/msl/generator_impl_array_accessor_test.cc b/src/writer/msl/generator_impl_array_accessor_test.cc
index 1560773..41da259 100644
--- a/src/writer/msl/generator_impl_array_accessor_test.cc
+++ b/src/writer/msl/generator_impl_array_accessor_test.cc
@@ -33,7 +33,7 @@
TEST_F(MslGeneratorImplTest, EmitExpression_ArrayAccessor) {
ast::type::I32 i32;
- auto* lit = create<ast::SintLiteral>(&i32, 5);
+ auto* lit = create<ast::SintLiteral>(Source{}, &i32, 5);
auto* idx = create<ast::ScalarConstructorExpression>(lit);
auto* ary =
create<ast::IdentifierExpression>(mod.RegisterSymbol("ary"), "ary");
diff --git a/src/writer/msl/generator_impl_case_test.cc b/src/writer/msl/generator_impl_case_test.cc
index e8e2244..5740d2a 100644
--- a/src/writer/msl/generator_impl_case_test.cc
+++ b/src/writer/msl/generator_impl_case_test.cc
@@ -39,7 +39,7 @@
body->append(create<ast::BreakStatement>());
ast::CaseSelectorList lit;
- lit.push_back(create<ast::SintLiteral>(&i32, 5));
+ lit.push_back(create<ast::SintLiteral>(Source{}, &i32, 5));
ast::CaseStatement c(lit, body);
gen.increment_indent();
@@ -55,7 +55,7 @@
ast::type::I32 i32;
ast::CaseSelectorList lit;
- lit.push_back(create<ast::SintLiteral>(&i32, 5));
+ lit.push_back(create<ast::SintLiteral>(Source{}, &i32, 5));
ast::CaseStatement c(lit, create<ast::BlockStatement>());
gen.increment_indent();
@@ -74,7 +74,7 @@
body->append(create<ast::FallthroughStatement>());
ast::CaseSelectorList lit;
- lit.push_back(create<ast::SintLiteral>(&i32, 5));
+ lit.push_back(create<ast::SintLiteral>(Source{}, &i32, 5));
ast::CaseStatement c(lit, body);
gen.increment_indent();
@@ -93,8 +93,8 @@
body->append(create<ast::BreakStatement>());
ast::CaseSelectorList lit;
- lit.push_back(create<ast::SintLiteral>(&i32, 5));
- lit.push_back(create<ast::SintLiteral>(&i32, 6));
+ lit.push_back(create<ast::SintLiteral>(Source{}, &i32, 5));
+ lit.push_back(create<ast::SintLiteral>(Source{}, &i32, 6));
ast::CaseStatement c(lit, body);
gen.increment_indent();
diff --git a/src/writer/msl/generator_impl_constructor_test.cc b/src/writer/msl/generator_impl_constructor_test.cc
index cd83117..0f50308 100644
--- a/src/writer/msl/generator_impl_constructor_test.cc
+++ b/src/writer/msl/generator_impl_constructor_test.cc
@@ -39,7 +39,7 @@
TEST_F(MslGeneratorImplTest, EmitConstructor_Bool) {
ast::type::Bool bool_type;
- auto* lit = create<ast::BoolLiteral>(&bool_type, false);
+ auto* lit = create<ast::BoolLiteral>(Source{}, &bool_type, false);
ast::ScalarConstructorExpression expr(lit);
ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error();
@@ -48,7 +48,7 @@
TEST_F(MslGeneratorImplTest, EmitConstructor_Int) {
ast::type::I32 i32;
- auto* lit = create<ast::SintLiteral>(&i32, -12345);
+ auto* lit = create<ast::SintLiteral>(Source{}, &i32, -12345);
ast::ScalarConstructorExpression expr(lit);
ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error();
@@ -57,7 +57,7 @@
TEST_F(MslGeneratorImplTest, EmitConstructor_UInt) {
ast::type::U32 u32;
- auto* lit = create<ast::UintLiteral>(&u32, 56779);
+ auto* lit = create<ast::UintLiteral>(Source{}, &u32, 56779);
ast::ScalarConstructorExpression expr(lit);
ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error();
@@ -67,8 +67,8 @@
TEST_F(MslGeneratorImplTest, EmitConstructor_Float) {
ast::type::F32 f32;
// Use a number close to 1<<30 but whose decimal representation ends in 0.
- auto* lit =
- create<ast::FloatLiteral>(&f32, static_cast<float>((1 << 30) - 4));
+ auto* lit = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>((1 << 30) - 4));
ast::ScalarConstructorExpression expr(lit);
ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error();
@@ -78,7 +78,7 @@
TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Float) {
ast::type::F32 f32;
- auto* lit = create<ast::FloatLiteral>(&f32, -1.2e-5);
+ auto* lit = create<ast::FloatLiteral>(Source{}, &f32, -1.2e-5);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit));
@@ -91,7 +91,7 @@
TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Bool) {
ast::type::Bool b;
- auto* lit = create<ast::BoolLiteral>(&b, true);
+ auto* lit = create<ast::BoolLiteral>(Source{}, &b, true);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit));
@@ -104,7 +104,7 @@
TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Int) {
ast::type::I32 i32;
- auto* lit = create<ast::SintLiteral>(&i32, -12345);
+ auto* lit = create<ast::SintLiteral>(Source{}, &i32, -12345);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit));
@@ -117,7 +117,7 @@
TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Uint) {
ast::type::U32 u32;
- auto* lit = create<ast::UintLiteral>(&u32, 12345);
+ auto* lit = create<ast::UintLiteral>(Source{}, &u32, 12345);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit));
@@ -131,9 +131,9 @@
ast::type::F32 f32;
ast::type::Vector vec(&f32, 3);
- auto* lit1 = create<ast::FloatLiteral>(&f32, 1.f);
- auto* lit2 = create<ast::FloatLiteral>(&f32, 2.f);
- auto* lit3 = create<ast::FloatLiteral>(&f32, 3.f);
+ auto* lit1 = create<ast::FloatLiteral>(Source{}, &f32, 1.f);
+ auto* lit2 = create<ast::FloatLiteral>(Source{}, &f32, 2.f);
+ auto* lit3 = create<ast::FloatLiteral>(Source{}, &f32, 3.f);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit1));
values.push_back(create<ast::ScalarConstructorExpression>(lit2));
@@ -167,12 +167,12 @@
ast::ExpressionList mat_values;
for (size_t i = 0; i < 2; i++) {
- auto* lit1 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(1 + (i * 2)));
- auto* lit2 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(2 + (i * 2)));
- auto* lit3 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(3 + (i * 2)));
+ auto* lit1 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(1 + (i * 2)));
+ auto* lit2 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(2 + (i * 2)));
+ auto* lit3 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(3 + (i * 2)));
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit1));
@@ -199,12 +199,12 @@
ast::ExpressionList ary_values;
for (size_t i = 0; i < 3; i++) {
- auto* lit1 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(1 + (i * 3)));
- auto* lit2 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(2 + (i * 3)));
- auto* lit3 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(3 + (i * 3)));
+ auto* lit1 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(1 + (i * 3)));
+ auto* lit2 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(2 + (i * 3)));
+ auto* lit3 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(3 + (i * 3)));
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit1));
diff --git a/src/writer/msl/generator_impl_function_test.cc b/src/writer/msl/generator_impl_function_test.cc
index 680441f..d7cd5f1 100644
--- a/src/writer/msl/generator_impl_function_test.cc
+++ b/src/writer/msl/generator_impl_function_test.cc
@@ -594,7 +594,7 @@
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
@@ -685,7 +685,7 @@
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
@@ -791,7 +791,7 @@
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
body = create<ast::BlockStatement>();
body->append(create<ast::AssignmentStatement>(
@@ -879,7 +879,7 @@
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
auto* var =
create<ast::Variable>(Source{}, // source
@@ -985,7 +985,7 @@
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
auto* var =
create<ast::Variable>(Source{}, // source
@@ -1097,7 +1097,7 @@
ast::ExpressionList expr;
expr.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
auto* var =
create<ast::Variable>(Source{}, // source
@@ -1172,18 +1172,19 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod.RegisterSymbol("bar"), "bar"),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f))));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f))));
auto* list = create<ast::BlockStatement>();
list->append(create<ast::ReturnStatement>(Source{}));
body->append(create<ast::IfStatement>(
Source{},
- create<ast::BinaryExpression>(ast::BinaryOp::kEqual,
- create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
- create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1))),
+ create<ast::BinaryExpression>(
+ ast::BinaryOp::kEqual,
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(Source{}, &i32, 1))),
list, ast::ElseStatementList{}));
body->append(create<ast::ReturnStatement>(Source{}));
diff --git a/src/writer/msl/generator_impl_import_test.cc b/src/writer/msl/generator_impl_import_test.cc
index d543348..1d654c2 100644
--- a/src/writer/msl/generator_impl_import_test.cc
+++ b/src/writer/msl/generator_impl_import_test.cc
@@ -55,7 +55,7 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* ident = create<ast::IdentifierExpression>(
mod.RegisterSymbol(param.name), param.name);
@@ -99,7 +99,7 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
ast::CallExpression expr(
create<ast::IdentifierExpression>(mod.RegisterSymbol("abs"), "abs"),
@@ -119,9 +119,9 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.f)));
ast::CallExpression expr(create<ast::IdentifierExpression>(
mod.RegisterSymbol(param.name), param.name),
@@ -155,21 +155,21 @@
params.push_back(create<ast::TypeConstructorExpression>(
&vec, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 2.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 3.f)),
}));
params.push_back(create<ast::TypeConstructorExpression>(
&vec, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 4.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 4.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 5.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 5.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 6.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 6.f)),
}));
ast::CallExpression expr(create<ast::IdentifierExpression>(
@@ -194,9 +194,9 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)));
+ create<ast::SintLiteral>(Source{}, &i32, 2)));
ast::CallExpression expr(create<ast::IdentifierExpression>(
mod.RegisterSymbol(param.name), param.name),
@@ -219,11 +219,11 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.f)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.f)));
ast::CallExpression expr(create<ast::IdentifierExpression>(
mod.RegisterSymbol(param.name), param.name),
@@ -251,11 +251,11 @@
ast::ExpressionList params;
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)));
+ create<ast::SintLiteral>(Source{}, &i32, 2)));
params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)));
+ create<ast::SintLiteral>(Source{}, &i32, 3)));
ast::CallExpression expr(create<ast::IdentifierExpression>(
mod.RegisterSymbol(param.name), param.name),
diff --git a/src/writer/msl/generator_impl_loop_test.cc b/src/writer/msl/generator_impl_loop_test.cc
index b6c91fd..004af07 100644
--- a/src/writer/msl/generator_impl_loop_test.cc
+++ b/src/writer/msl/generator_impl_loop_test.cc
@@ -158,8 +158,8 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.4)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::FloatLiteral>(Source{}, &f32, 2.4)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* body = create<ast::BlockStatement>();
body->append(create<ast::VariableDeclStatement>(var));
diff --git a/src/writer/msl/generator_impl_module_constant_test.cc b/src/writer/msl/generator_impl_module_constant_test.cc
index efe5ee0..980beea 100644
--- a/src/writer/msl/generator_impl_module_constant_test.cc
+++ b/src/writer/msl/generator_impl_module_constant_test.cc
@@ -40,11 +40,11 @@
ast::ExpressionList exprs;
exprs.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
exprs.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.0f)));
exprs.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
auto* var = create<ast::Variable>(
Source{}, // source
@@ -69,7 +69,7 @@
&f32, // type
true, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)), // constructor
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)), // constructor
ast::VariableDecorationList{
// decorations
create<ast::ConstantIdDecoration>(23, Source{}),
diff --git a/src/writer/msl/generator_impl_switch_test.cc b/src/writer/msl/generator_impl_switch_test.cc
index fd69599..0617374 100644
--- a/src/writer/msl/generator_impl_switch_test.cc
+++ b/src/writer/msl/generator_impl_switch_test.cc
@@ -39,7 +39,7 @@
ast::type::I32 i32;
ast::CaseSelectorList case_val;
- case_val.push_back(create<ast::SintLiteral>(&i32, 5));
+ case_val.push_back(create<ast::SintLiteral>(Source{}, &i32, 5));
auto* case_body = create<ast::BlockStatement>();
case_body->append(create<ast::BreakStatement>());
diff --git a/src/writer/spirv/builder.cc b/src/writer/spirv/builder.cc
index 244844e..2143b57 100644
--- a/src/writer/spirv/builder.cc
+++ b/src/writer/spirv/builder.cc
@@ -376,7 +376,7 @@
uint32_t Builder::GenerateU32Literal(uint32_t val) {
ast::type::U32 u32;
- ast::SintLiteral lit(&u32, val);
+ ast::SintLiteral lit(Source{}, &u32, val);
return GenerateLiteralIfNeeded(nullptr, &lit);
}
@@ -640,7 +640,7 @@
// TODO(dsinclair) We could detect if the constructor is fully const and emit
// an initializer value for the variable instead of doing the OpLoad.
- ast::NullLiteral nl(var->type()->UnwrapPtrIfNeeded());
+ ast::NullLiteral nl(Source{}, var->type()->UnwrapPtrIfNeeded());
auto null_id = GenerateLiteralIfNeeded(var, &nl);
if (null_id == 0) {
return 0;
@@ -741,16 +741,16 @@
// then WGSL requires an initializer.
if (var->HasConstantIdDecoration()) {
if (type->Is<ast::type::F32>()) {
- ast::FloatLiteral l(type, 0.0f);
+ ast::FloatLiteral l(Source{}, type, 0.0f);
init_id = GenerateLiteralIfNeeded(var, &l);
} else if (type->Is<ast::type::U32>()) {
- ast::UintLiteral l(type, 0);
+ ast::UintLiteral l(Source{}, type, 0);
init_id = GenerateLiteralIfNeeded(var, &l);
} else if (type->Is<ast::type::I32>()) {
- ast::SintLiteral l(type, 0);
+ ast::SintLiteral l(Source{}, type, 0);
init_id = GenerateLiteralIfNeeded(var, &l);
} else if (type->Is<ast::type::Bool>()) {
- ast::BoolLiteral l(type, false);
+ ast::BoolLiteral l(Source{}, type, false);
init_id = GenerateLiteralIfNeeded(var, &l);
} else {
error_ = "invalid type for constant_id, must be scalar";
@@ -763,7 +763,7 @@
} else if (var->storage_class() == ast::StorageClass::kPrivate ||
var->storage_class() == ast::StorageClass::kNone ||
var->storage_class() == ast::StorageClass::kOutput) {
- ast::NullLiteral nl(type);
+ ast::NullLiteral nl(Source{}, type);
init_id = GenerateLiteralIfNeeded(var, &nl);
if (init_id == 0) {
return 0;
@@ -1015,7 +1015,7 @@
auto ary_result = result_op();
- ast::NullLiteral nl(ary_res_type);
+ ast::NullLiteral nl(Source{}, ary_res_type);
auto init = GenerateLiteralIfNeeded(nullptr, &nl);
// If we're access chaining into an array then we must be in a function
@@ -1220,7 +1220,7 @@
// Generate the zero initializer if there are no values provided.
if (values.empty()) {
- ast::NullLiteral nl(init->type()->UnwrapPtrIfNeeded());
+ ast::NullLiteral nl(Source{}, init->type()->UnwrapPtrIfNeeded());
return GenerateLiteralIfNeeded(nullptr, &nl);
}
@@ -2053,7 +2053,7 @@
spirv_params.emplace_back(gen_param(pidx.depth_ref));
ast::type::F32 f32;
- ast::FloatLiteral float_0(&f32, 0.0);
+ ast::FloatLiteral float_0(Source{}, &f32, 0.0);
image_operands.emplace_back(ImageOperand{
SpvImageOperandsLodMask,
Operand::Int(GenerateLiteralIfNeeded(nullptr, &float_0))});
diff --git a/src/writer/spirv/builder_accessor_expression_test.cc b/src/writer/spirv/builder_accessor_expression_test.cc
index 32be705..157e0cd 100644
--- a/src/writer/spirv/builder_accessor_expression_test.cc
+++ b/src/writer/spirv/builder_accessor_expression_test.cc
@@ -59,7 +59,7 @@
auto* ary =
create<ast::IdentifierExpression>(mod->RegisterSymbol("ary"), "ary");
auto* idx_expr = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1));
+ create<ast::SintLiteral>(Source{}, &i32, 1));
ast::ArrayAccessorExpression expr(ary, idx_expr);
@@ -152,12 +152,12 @@
create<ast::IdentifierExpression>(mod->RegisterSymbol("ary"), "ary");
ast::ArrayAccessorExpression expr(
- ary,
- create<ast::BinaryExpression>(ast::BinaryOp::kAdd,
- create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
- create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))));
+ ary, create<ast::BinaryExpression>(
+ ast::BinaryOp::kAdd,
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(Source{}, &i32, 2))));
td.RegisterVariableForTesting(&var);
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
@@ -201,9 +201,9 @@
create<ast::ArrayAccessorExpression>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("ary"), "ary"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3))),
+ create<ast::SintLiteral>(Source{}, &i32, 3))),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)));
+ create<ast::SintLiteral>(Source{}, &i32, 2)));
td.RegisterVariableForTesting(&var);
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
@@ -249,7 +249,7 @@
create<ast::ArrayAccessorExpression>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("ary"), "ary"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))),
+ create<ast::SintLiteral>(Source{}, &i32, 2))),
create<ast::IdentifierExpression>(mod->RegisterSymbol("xy"), "xy"));
td.RegisterVariableForTesting(&var);
@@ -492,7 +492,7 @@
create<ast::IdentifierExpression>(mod->RegisterSymbol("a"), "a"));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.f));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.f));
ast::AssignmentStatement expr(lhs, rhs);
@@ -766,7 +766,7 @@
"ident"),
create<ast::IdentifierExpression>(mod->RegisterSymbol("yxz"), "yxz")),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
td.RegisterVariableForTesting(&var);
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
@@ -840,11 +840,11 @@
create<ast::IdentifierExpression>(
mod->RegisterSymbol("index"), "index"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 0))),
+ create<ast::SintLiteral>(Source{}, &i32, 0))),
create<ast::IdentifierExpression>(
mod->RegisterSymbol("foo"), "foo")),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))),
+ create<ast::SintLiteral>(Source{}, &i32, 2))),
create<ast::IdentifierExpression>(mod->RegisterSymbol("bar"),
"bar")),
create<ast::IdentifierExpression>(mod->RegisterSymbol("baz"), "baz")),
@@ -903,25 +903,25 @@
ary_params.push_back(create<ast::TypeConstructorExpression>(
&vec, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 0.0)),
+ create<ast::FloatLiteral>(Source{}, &f32, 0.0)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 0.5)),
+ create<ast::FloatLiteral>(Source{}, &f32, 0.5)),
}));
ary_params.push_back(create<ast::TypeConstructorExpression>(
&vec, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, -0.5)),
+ create<ast::FloatLiteral>(Source{}, &f32, -0.5)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, -0.5)),
+ create<ast::FloatLiteral>(Source{}, &f32, -0.5)),
}));
ary_params.push_back(create<ast::TypeConstructorExpression>(
&vec, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 0.5)),
+ create<ast::FloatLiteral>(Source{}, &f32, 0.5)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, -0.5)),
+ create<ast::FloatLiteral>(Source{}, &f32, -0.5)),
}));
ast::Variable var(Source{}, "pos", ast::StorageClass::kPrivate, &arr, true,
@@ -931,7 +931,7 @@
ast::ArrayAccessorExpression expr(
create<ast::IdentifierExpression>(mod->RegisterSymbol("pos"), "pos"),
create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
td.RegisterVariableForTesting(&var);
ASSERT_TRUE(td.DetermineResultType(var.constructor())) << td.error();
@@ -977,9 +977,9 @@
ast::ExpressionList vec_params;
vec_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 0.0)));
+ create<ast::FloatLiteral>(Source{}, &f32, 0.0)));
vec_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 0.5)));
+ create<ast::FloatLiteral>(Source{}, &f32, 0.5)));
ast::Variable var(
Source{}, "pos", ast::StorageClass::kPrivate, &vec, true,
@@ -989,7 +989,7 @@
ast::ArrayAccessorExpression expr(
create<ast::IdentifierExpression>(mod->RegisterSymbol("pos"), "pos"),
create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)));
+ create<ast::UintLiteral>(Source{}, &u32, 1)));
td.RegisterVariableForTesting(&var);
ASSERT_TRUE(td.DetermineResultType(var.constructor())) << td.error();
diff --git a/src/writer/spirv/builder_assign_test.cc b/src/writer/spirv/builder_assign_test.cc
index 2285beb..8947438 100644
--- a/src/writer/spirv/builder_assign_test.cc
+++ b/src/writer/spirv/builder_assign_test.cc
@@ -50,7 +50,7 @@
auto* ident =
create<ast::IdentifierExpression>(mod->RegisterSymbol("var"), "var");
auto* val = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f));
ast::AssignmentStatement assign(ident, val);
@@ -120,16 +120,16 @@
auto* first = create<ast::TypeConstructorExpression>(
&vec2, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 2.0f)),
});
auto* init = create<ast::TypeConstructorExpression>(
&vec3, ast::ExpressionList{
first,
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)),
});
ast::Variable v(Source{}, "var", ast::StorageClass::kOutput, &vec3, false,
@@ -174,11 +174,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
auto* init = create<ast::TypeConstructorExpression>(&vec3, vals);
@@ -239,7 +239,7 @@
create<ast::IdentifierExpression>(mod->RegisterSymbol("b"), "b"));
auto* val = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 4.0f));
+ create<ast::FloatLiteral>(Source{}, &f32, 4.0f));
ast::AssignmentStatement assign(ident, val);
@@ -282,11 +282,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
auto* val = create<ast::TypeConstructorExpression>(&vec3, vals);
@@ -330,7 +330,7 @@
create<ast::IdentifierExpression>(mod->RegisterSymbol("var"), "var"),
create<ast::IdentifierExpression>(mod->RegisterSymbol("y"), "y"));
auto* val = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f));
ast::AssignmentStatement assign(ident, val);
@@ -375,9 +375,9 @@
auto* ident = create<ast::ArrayAccessorExpression>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("var"), "var"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
auto* val = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f));
ast::AssignmentStatement assign(ident, val);
diff --git a/src/writer/spirv/builder_binary_expression_test.cc b/src/writer/spirv/builder_binary_expression_test.cc
index 880834e..1fdfd7a 100644
--- a/src/writer/spirv/builder_binary_expression_test.cc
+++ b/src/writer/spirv/builder_binary_expression_test.cc
@@ -57,9 +57,9 @@
ast::type::I32 i32;
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3));
+ create<ast::SintLiteral>(Source{}, &i32, 3));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 4));
+ create<ast::SintLiteral>(Source{}, &i32, 4));
ast::BinaryExpression expr(param.op, lhs, rhs);
@@ -84,21 +84,21 @@
auto* lhs = create<ast::TypeConstructorExpression>(
&vec3, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
});
auto* rhs = create<ast::TypeConstructorExpression>(
&vec3, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
});
ast::BinaryExpression expr(param.op, lhs, rhs);
@@ -175,9 +175,9 @@
ast::type::U32 u32;
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 3));
+ create<ast::UintLiteral>(Source{}, &u32, 3));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 4));
+ create<ast::UintLiteral>(Source{}, &u32, 4));
ast::BinaryExpression expr(param.op, lhs, rhs);
@@ -202,21 +202,21 @@
auto* lhs = create<ast::TypeConstructorExpression>(
&vec3, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)),
+ create<ast::UintLiteral>(Source{}, &u32, 1)),
create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)),
+ create<ast::UintLiteral>(Source{}, &u32, 1)),
create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)),
+ create<ast::UintLiteral>(Source{}, &u32, 1)),
});
auto* rhs = create<ast::TypeConstructorExpression>(
&vec3, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)),
+ create<ast::UintLiteral>(Source{}, &u32, 1)),
create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)),
+ create<ast::UintLiteral>(Source{}, &u32, 1)),
create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)),
+ create<ast::UintLiteral>(Source{}, &u32, 1)),
});
ast::BinaryExpression expr(param.op, lhs, rhs);
@@ -256,9 +256,9 @@
ast::type::F32 f32;
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.2f));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.2f));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 4.5f));
+ create<ast::FloatLiteral>(Source{}, &f32, 4.5f));
ast::BinaryExpression expr(param.op, lhs, rhs);
@@ -283,21 +283,21 @@
auto* lhs = create<ast::TypeConstructorExpression>(
&vec3, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
});
auto* rhs = create<ast::TypeConstructorExpression>(
&vec3, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
});
ast::BinaryExpression expr(param.op, lhs, rhs);
@@ -331,9 +331,9 @@
ast::type::U32 u32;
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 3));
+ create<ast::UintLiteral>(Source{}, &u32, 3));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 4));
+ create<ast::UintLiteral>(Source{}, &u32, 4));
ast::BinaryExpression expr(param.op, lhs, rhs);
@@ -360,21 +360,21 @@
auto* lhs = create<ast::TypeConstructorExpression>(
&vec3, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)),
+ create<ast::UintLiteral>(Source{}, &u32, 1)),
create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)),
+ create<ast::UintLiteral>(Source{}, &u32, 1)),
create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)),
+ create<ast::UintLiteral>(Source{}, &u32, 1)),
});
auto* rhs = create<ast::TypeConstructorExpression>(
&vec3, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)),
+ create<ast::UintLiteral>(Source{}, &u32, 1)),
create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)),
+ create<ast::UintLiteral>(Source{}, &u32, 1)),
create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, 1)),
+ create<ast::UintLiteral>(Source{}, &u32, 1)),
});
ast::BinaryExpression expr(param.op, lhs, rhs);
@@ -412,9 +412,9 @@
ast::type::I32 i32;
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3));
+ create<ast::SintLiteral>(Source{}, &i32, 3));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 4));
+ create<ast::SintLiteral>(Source{}, &i32, 4));
ast::BinaryExpression expr(param.op, lhs, rhs);
@@ -441,21 +441,21 @@
auto* lhs = create<ast::TypeConstructorExpression>(
&vec3, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
});
auto* rhs = create<ast::TypeConstructorExpression>(
&vec3, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
});
ast::BinaryExpression expr(param.op, lhs, rhs);
@@ -493,9 +493,9 @@
ast::type::F32 f32;
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.2f));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.2f));
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 4.5f));
+ create<ast::FloatLiteral>(Source{}, &f32, 4.5f));
ast::BinaryExpression expr(param.op, lhs, rhs);
@@ -522,21 +522,21 @@
auto* lhs = create<ast::TypeConstructorExpression>(
&vec3, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
});
auto* rhs = create<ast::TypeConstructorExpression>(
&vec3, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
});
ast::BinaryExpression expr(param.op, lhs, rhs);
@@ -574,15 +574,15 @@
auto* lhs = create<ast::TypeConstructorExpression>(
&vec3, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)),
});
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f));
ast::BinaryExpression expr(ast::BinaryOp::kMultiply, lhs, rhs);
@@ -605,15 +605,15 @@
ast::type::Vector vec3(&f32, 3);
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f));
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* rhs = create<ast::TypeConstructorExpression>(&vec3, vals);
ast::BinaryExpression expr(ast::BinaryOp::kMultiply, lhs, rhs);
@@ -647,7 +647,7 @@
auto* lhs =
create<ast::IdentifierExpression>(mod->RegisterSymbol("mat"), "mat");
auto* rhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f));
td.RegisterVariableForTesting(var);
@@ -685,7 +685,7 @@
nullptr, // constructor
ast::VariableDecorationList{}); // decorations
auto* lhs = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f));
auto* rhs =
create<ast::IdentifierExpression>(mod->RegisterSymbol("mat"), "mat");
@@ -730,11 +730,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* rhs = create<ast::TypeConstructorExpression>(&vec3, vals);
td.RegisterVariableForTesting(var);
@@ -777,11 +777,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
auto* lhs = create<ast::TypeConstructorExpression>(&vec3, vals);
auto* rhs =
@@ -855,19 +855,19 @@
TEST_F(BuilderTest, Binary_LogicalAnd) {
ast::type::I32 i32;
- auto* lhs =
- create<ast::BinaryExpression>(ast::BinaryOp::kEqual,
- create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
- create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)));
+ auto* lhs = create<ast::BinaryExpression>(
+ ast::BinaryOp::kEqual,
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(Source{}, &i32, 2)));
- auto* rhs =
- create<ast::BinaryExpression>(ast::BinaryOp::kEqual,
- create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)),
- create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 4)));
+ auto* rhs = create<ast::BinaryExpression>(
+ ast::BinaryOp::kEqual,
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(Source{}, &i32, 3)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(Source{}, &i32, 4)));
ast::BinaryExpression expr(ast::BinaryOp::kLogicalAnd, lhs, rhs);
@@ -907,17 +907,17 @@
&bool_type, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::BoolLiteral>(Source{}, &bool_type, true)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* b_var = create<ast::Variable>(
Source{}, // source
"b", // name
ast::StorageClass::kFunction, // storage_class
&bool_type, // type
false, // is_const
- create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, false)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::ScalarConstructorExpression>(create<ast::BoolLiteral>(
+ Source{}, &bool_type, false)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* lhs = create<ast::IdentifierExpression>(mod->RegisterSymbol("a"), "a");
auto* rhs = create<ast::IdentifierExpression>(mod->RegisterSymbol("b"), "b");
@@ -966,14 +966,15 @@
auto* logical_and_expr = create<ast::BinaryExpression>(
ast::BinaryOp::kLogicalAnd,
create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_ty, true)),
+ create<ast::BoolLiteral>(Source{}, &bool_ty, true)),
create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_ty, false)));
+ create<ast::BoolLiteral>(Source{}, &bool_ty, false)));
- ast::BinaryExpression expr(ast::BinaryOp::kLogicalOr,
- create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_ty, true)),
- logical_and_expr);
+ ast::BinaryExpression expr(
+ ast::BinaryOp::kLogicalOr,
+ create<ast::ScalarConstructorExpression>(
+ create<ast::BoolLiteral>(Source{}, &bool_ty, true)),
+ logical_and_expr);
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
@@ -1012,14 +1013,15 @@
auto* logical_or_expr = create<ast::BinaryExpression>(
ast::BinaryOp::kLogicalOr,
create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_ty, true)),
+ create<ast::BoolLiteral>(Source{}, &bool_ty, true)),
create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_ty, false)));
+ create<ast::BoolLiteral>(Source{}, &bool_ty, false)));
- ast::BinaryExpression expr(ast::BinaryOp::kLogicalAnd,
- create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_ty, true)),
- logical_or_expr);
+ ast::BinaryExpression expr(
+ ast::BinaryOp::kLogicalAnd,
+ create<ast::ScalarConstructorExpression>(
+ create<ast::BoolLiteral>(Source{}, &bool_ty, true)),
+ logical_or_expr);
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
@@ -1051,19 +1053,19 @@
TEST_F(BuilderTest, Binary_LogicalOr) {
ast::type::I32 i32;
- auto* lhs =
- create<ast::BinaryExpression>(ast::BinaryOp::kEqual,
- create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)),
- create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)));
+ auto* lhs = create<ast::BinaryExpression>(
+ ast::BinaryOp::kEqual,
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(Source{}, &i32, 1)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(Source{}, &i32, 2)));
- auto* rhs =
- create<ast::BinaryExpression>(ast::BinaryOp::kEqual,
- create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3)),
- create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 4)));
+ auto* rhs = create<ast::BinaryExpression>(
+ ast::BinaryOp::kEqual,
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(Source{}, &i32, 3)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::SintLiteral>(Source{}, &i32, 4)));
ast::BinaryExpression expr(ast::BinaryOp::kLogicalOr, lhs, rhs);
@@ -1103,17 +1105,17 @@
&bool_type, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::BoolLiteral>(Source{}, &bool_type, true)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* b_var = create<ast::Variable>(
Source{}, // source
"b", // name
ast::StorageClass::kFunction, // storage_class
&bool_type, // type
false, // is_const
- create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, false)), // constructor
- ast::VariableDecorationList{}); // decorations
+ create<ast::ScalarConstructorExpression>(create<ast::BoolLiteral>(
+ Source{}, &bool_type, false)), // constructor
+ ast::VariableDecorationList{}); // decorations
auto* lhs = create<ast::IdentifierExpression>(mod->RegisterSymbol("a"), "a");
auto* rhs = create<ast::IdentifierExpression>(mod->RegisterSymbol("b"), "b");
diff --git a/src/writer/spirv/builder_bitcast_expression_test.cc b/src/writer/spirv/builder_bitcast_expression_test.cc
index ee166f7..b9ccae7 100644
--- a/src/writer/spirv/builder_bitcast_expression_test.cc
+++ b/src/writer/spirv/builder_bitcast_expression_test.cc
@@ -35,9 +35,9 @@
ast::type::U32 u32;
ast::type::F32 f32;
- ast::BitcastExpression bitcast(&u32,
- create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.4)));
+ ast::BitcastExpression bitcast(
+ &u32, create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(Source{}, &f32, 2.4)));
ASSERT_TRUE(td.DetermineResultType(&bitcast)) << td.error();
@@ -56,9 +56,9 @@
TEST_F(BuilderTest, Bitcast_DuplicateType) {
ast::type::F32 f32;
- ast::BitcastExpression bitcast(&f32,
- create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.4)));
+ ast::BitcastExpression bitcast(
+ &f32, create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(Source{}, &f32, 2.4)));
ASSERT_TRUE(td.DetermineResultType(&bitcast)) << td.error();
diff --git a/src/writer/spirv/builder_block_test.cc b/src/writer/spirv/builder_block_test.cc
index 838a084..7dea26e 100644
--- a/src/writer/spirv/builder_block_test.cc
+++ b/src/writer/spirv/builder_block_test.cc
@@ -52,7 +52,7 @@
outer.append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("var"), "var"),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f))));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f))));
auto* inner = create<ast::BlockStatement>();
inner->append(create<ast::VariableDeclStatement>(
@@ -66,13 +66,13 @@
inner->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("var"), "var"),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0f))));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.0f))));
outer.append(inner);
outer.append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("var"), "var"),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f))));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f))));
ASSERT_TRUE(td.DetermineResultType(&outer)) << td.error();
diff --git a/src/writer/spirv/builder_call_test.cc b/src/writer/spirv/builder_call_test.cc
index 8cc1ba2..e7a7b52 100644
--- a/src/writer/spirv/builder_call_test.cc
+++ b/src/writer/spirv/builder_call_test.cc
@@ -77,9 +77,9 @@
ast::ExpressionList call_params;
call_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
call_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
ast::CallExpression expr(create<ast::IdentifierExpression>(
mod->RegisterSymbol("a_func"), "a_func"),
@@ -159,9 +159,9 @@
ast::ExpressionList call_params;
call_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
call_params.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.f)));
ast::CallStatement expr(
create<ast::CallExpression>(create<ast::IdentifierExpression>(
diff --git a/src/writer/spirv/builder_function_variable_test.cc b/src/writer/spirv/builder_function_variable_test.cc
index fcdfeb3..8e40bad 100644
--- a/src/writer/spirv/builder_function_variable_test.cc
+++ b/src/writer/spirv/builder_function_variable_test.cc
@@ -70,11 +70,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
auto* init = create<ast::TypeConstructorExpression>(&vec, vals);
@@ -110,16 +110,16 @@
ast::type::F32 f32;
ast::type::Vector vec(&f32, 2);
- auto* rel =
- create<ast::BinaryExpression>(ast::BinaryOp::kAdd,
- create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)),
- create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ auto* rel = create<ast::BinaryExpression>(
+ ast::BinaryOp::kAdd,
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)),
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(rel);
auto* init = create<ast::TypeConstructorExpression>(&vec, vals);
@@ -160,7 +160,7 @@
ast::type::F32 f32;
auto* init = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f));
ASSERT_TRUE(td.DetermineResultType(init)) << td.error();
@@ -207,7 +207,7 @@
ast::type::F32 f32;
auto* init = create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f));
EXPECT_TRUE(td.DetermineResultType(init)) << td.error();
@@ -250,11 +250,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
auto* init = create<ast::TypeConstructorExpression>(&vec, vals);
diff --git a/src/writer/spirv/builder_global_variable_test.cc b/src/writer/spirv/builder_global_variable_test.cc
index 16062c2..9a8f136 100644
--- a/src/writer/spirv/builder_global_variable_test.cc
+++ b/src/writer/spirv/builder_global_variable_test.cc
@@ -99,11 +99,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
auto* init = create<ast::TypeConstructorExpression>(&vec, vals);
@@ -135,11 +135,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
auto* init = create<ast::TypeConstructorExpression>(&vec, vals);
@@ -168,11 +168,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 2.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
auto* init = create<ast::TypeConstructorExpression>(&vec3, vals);
EXPECT_TRUE(td.DetermineResultType(init)) << td.error();
@@ -201,16 +201,16 @@
auto* first = create<ast::TypeConstructorExpression>(
&vec2, ast::ExpressionList{
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)),
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 2.0f)),
});
auto* init = create<ast::TypeConstructorExpression>(
&vec3, ast::ExpressionList{
first,
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)),
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)),
});
EXPECT_TRUE(td.DetermineResultType(init)) << td.error();
@@ -328,7 +328,7 @@
&bool_type, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true)), // constructor
+ create<ast::BoolLiteral>(Source{}, &bool_type, true)), // constructor
ast::VariableDecorationList{
// decorations
create<ast::ConstantIdDecoration>(1200, Source{}),
@@ -383,7 +383,7 @@
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 2.0)), // constructor
+ create<ast::FloatLiteral>(Source{}, &f32, 2.0)), // constructor
ast::VariableDecorationList{
// decorations
create<ast::ConstantIdDecoration>(0, Source{}),
diff --git a/src/writer/spirv/builder_ident_expression_test.cc b/src/writer/spirv/builder_ident_expression_test.cc
index d678c76..4f1f3af 100644
--- a/src/writer/spirv/builder_ident_expression_test.cc
+++ b/src/writer/spirv/builder_ident_expression_test.cc
@@ -43,11 +43,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
auto* init = create<ast::TypeConstructorExpression>(&vec, vals);
@@ -102,11 +102,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
auto* init = create<ast::TypeConstructorExpression>(&vec, vals);
@@ -195,7 +195,7 @@
ast::Variable var(Source{}, "var", ast::StorageClass::kNone, &i32, true,
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2)),
+ create<ast::SintLiteral>(Source{}, &i32, 2)),
ast::VariableDecorationList{});
td.RegisterVariableForTesting(&var);
diff --git a/src/writer/spirv/builder_if_test.cc b/src/writer/spirv/builder_if_test.cc
index b85dff9..e3724bb 100644
--- a/src/writer/spirv/builder_if_test.cc
+++ b/src/writer/spirv/builder_if_test.cc
@@ -46,7 +46,7 @@
// if (true) {
// }
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
ast::IfStatement expr(Source{}, cond, create<ast::BlockStatement>(),
ast::ElseStatementList{});
@@ -88,10 +88,10 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))));
+ create<ast::SintLiteral>(Source{}, &i32, 2))));
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
ast::IfStatement expr(Source{}, cond, body, ast::ElseStatementList{});
@@ -142,16 +142,16 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))));
+ create<ast::SintLiteral>(Source{}, &i32, 2))));
auto* else_body = create<ast::BlockStatement>();
else_body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3))));
+ create<ast::SintLiteral>(Source{}, &i32, 3))));
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
ast::IfStatement expr(Source{}, cond, body,
{create<ast::ElseStatement>(else_body)});
@@ -208,19 +208,19 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))));
+ create<ast::SintLiteral>(Source{}, &i32, 2))));
auto* else_body = create<ast::BlockStatement>();
else_body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3))));
+ create<ast::SintLiteral>(Source{}, &i32, 3))));
auto* else_cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
ast::IfStatement expr(Source{}, cond, body,
{create<ast::ElseStatement>(else_cond, else_body)});
@@ -286,30 +286,30 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))));
+ create<ast::SintLiteral>(Source{}, &i32, 2))));
auto* elseif_1_body = create<ast::BlockStatement>();
elseif_1_body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3))));
+ create<ast::SintLiteral>(Source{}, &i32, 3))));
auto* elseif_2_body = create<ast::BlockStatement>();
elseif_2_body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 4))));
+ create<ast::SintLiteral>(Source{}, &i32, 4))));
auto* else_body = create<ast::BlockStatement>();
else_body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 5))));
+ create<ast::SintLiteral>(Source{}, &i32, 5))));
auto* elseif_1_cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
auto* elseif_2_cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, false));
+ create<ast::BoolLiteral>(Source{}, &bool_type, false));
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
ast::IfStatement expr(
Source{}, cond, body,
@@ -376,7 +376,7 @@
// }
// }
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
auto* if_body = create<ast::BlockStatement>();
if_body->append(create<ast::BreakStatement>());
@@ -424,7 +424,7 @@
// }
// }
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
auto* else_body = create<ast::BlockStatement>();
else_body->append(create<ast::BreakStatement>());
@@ -474,7 +474,7 @@
// }
// }
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
auto* if_body = create<ast::BlockStatement>();
if_body->append(create<ast::ContinueStatement>());
@@ -522,7 +522,7 @@
// }
// }
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
auto* else_body = create<ast::BlockStatement>();
else_body->append(create<ast::ContinueStatement>());
@@ -570,7 +570,7 @@
// return;
// }
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
auto* if_body = create<ast::BlockStatement>();
if_body->append(create<ast::ReturnStatement>(Source{}));
@@ -600,9 +600,9 @@
// return false;
// }
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true));
+ create<ast::BoolLiteral>(Source{}, &bool_type, true));
auto* cond2 = create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, false));
+ create<ast::BoolLiteral>(Source{}, &bool_type, false));
auto* if_body = create<ast::BlockStatement>();
if_body->append(create<ast::ReturnStatement>(Source{}, cond2));
diff --git a/src/writer/spirv/builder_literal_test.cc b/src/writer/spirv/builder_literal_test.cc
index a50f0ca..acecbde 100644
--- a/src/writer/spirv/builder_literal_test.cc
+++ b/src/writer/spirv/builder_literal_test.cc
@@ -35,7 +35,7 @@
TEST_F(BuilderTest, Literal_Bool_True) {
ast::type::Bool bool_type;
- ast::BoolLiteral b_true(&bool_type, true);
+ ast::BoolLiteral b_true(Source{}, &bool_type, true);
auto id = b.GenerateLiteralIfNeeded(nullptr, &b_true);
ASSERT_FALSE(b.has_error()) << b.error();
@@ -48,7 +48,7 @@
TEST_F(BuilderTest, Literal_Bool_False) {
ast::type::Bool bool_type;
- ast::BoolLiteral b_false(&bool_type, false);
+ ast::BoolLiteral b_false(Source{}, &bool_type, false);
auto id = b.GenerateLiteralIfNeeded(nullptr, &b_false);
ASSERT_FALSE(b.has_error()) << b.error();
@@ -61,8 +61,8 @@
TEST_F(BuilderTest, Literal_Bool_Dedup) {
ast::type::Bool bool_type;
- ast::BoolLiteral b_true(&bool_type, true);
- ast::BoolLiteral b_false(&bool_type, false);
+ ast::BoolLiteral b_true(Source{}, &bool_type, true);
+ ast::BoolLiteral b_false(Source{}, &bool_type, false);
ASSERT_NE(b.GenerateLiteralIfNeeded(nullptr, &b_true), 0u);
ASSERT_FALSE(b.has_error()) << b.error();
@@ -79,7 +79,7 @@
TEST_F(BuilderTest, Literal_I32) {
ast::type::I32 i32;
- ast::SintLiteral i(&i32, -23);
+ ast::SintLiteral i(Source{}, &i32, -23);
auto id = b.GenerateLiteralIfNeeded(nullptr, &i);
ASSERT_FALSE(b.has_error()) << b.error();
@@ -92,8 +92,8 @@
TEST_F(BuilderTest, Literal_I32_Dedup) {
ast::type::I32 i32;
- ast::SintLiteral i1(&i32, -23);
- ast::SintLiteral i2(&i32, -23);
+ ast::SintLiteral i1(Source{}, &i32, -23);
+ ast::SintLiteral i2(Source{}, &i32, -23);
ASSERT_NE(b.GenerateLiteralIfNeeded(nullptr, &i1), 0u);
ASSERT_NE(b.GenerateLiteralIfNeeded(nullptr, &i2), 0u);
@@ -106,7 +106,7 @@
TEST_F(BuilderTest, Literal_U32) {
ast::type::U32 u32;
- ast::UintLiteral i(&u32, 23);
+ ast::UintLiteral i(Source{}, &u32, 23);
auto id = b.GenerateLiteralIfNeeded(nullptr, &i);
ASSERT_FALSE(b.has_error()) << b.error();
@@ -119,8 +119,8 @@
TEST_F(BuilderTest, Literal_U32_Dedup) {
ast::type::U32 u32;
- ast::UintLiteral i1(&u32, 23);
- ast::UintLiteral i2(&u32, 23);
+ ast::UintLiteral i1(Source{}, &u32, 23);
+ ast::UintLiteral i2(Source{}, &u32, 23);
ASSERT_NE(b.GenerateLiteralIfNeeded(nullptr, &i1), 0u);
ASSERT_NE(b.GenerateLiteralIfNeeded(nullptr, &i2), 0u);
@@ -133,7 +133,7 @@
TEST_F(BuilderTest, Literal_F32) {
ast::type::F32 f32;
- ast::FloatLiteral i(&f32, 23.245f);
+ ast::FloatLiteral i(Source{}, &f32, 23.245f);
auto id = b.GenerateLiteralIfNeeded(nullptr, &i);
ASSERT_FALSE(b.has_error()) << b.error();
@@ -146,8 +146,8 @@
TEST_F(BuilderTest, Literal_F32_Dedup) {
ast::type::F32 f32;
- ast::FloatLiteral i1(&f32, 23.245f);
- ast::FloatLiteral i2(&f32, 23.245f);
+ ast::FloatLiteral i1(Source{}, &f32, 23.245f);
+ ast::FloatLiteral i2(Source{}, &f32, 23.245f);
ASSERT_NE(b.GenerateLiteralIfNeeded(nullptr, &i1), 0u);
ASSERT_NE(b.GenerateLiteralIfNeeded(nullptr, &i2), 0u);
diff --git a/src/writer/spirv/builder_loop_test.cc b/src/writer/spirv/builder_loop_test.cc
index 5bc1327..98cffeb 100644
--- a/src/writer/spirv/builder_loop_test.cc
+++ b/src/writer/spirv/builder_loop_test.cc
@@ -78,7 +78,7 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))));
+ create<ast::SintLiteral>(Source{}, &i32, 2))));
ast::LoopStatement expr(body, create<ast::BlockStatement>());
@@ -131,13 +131,13 @@
body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))));
+ create<ast::SintLiteral>(Source{}, &i32, 2))));
auto* continuing = create<ast::BlockStatement>();
continuing->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3))));
+ create<ast::SintLiteral>(Source{}, &i32, 3))));
ast::LoopStatement expr(body, continuing);
td.RegisterVariableForTesting(var);
diff --git a/src/writer/spirv/builder_return_test.cc b/src/writer/spirv/builder_return_test.cc
index a219649..8c66100 100644
--- a/src/writer/spirv/builder_return_test.cc
+++ b/src/writer/spirv/builder_return_test.cc
@@ -51,11 +51,11 @@
ast::ExpressionList vals;
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 1.0f)));
vals.push_back(create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 3.0f)));
+ create<ast::FloatLiteral>(Source{}, &f32, 3.0f)));
auto* val = create<ast::TypeConstructorExpression>(&vec, vals);
diff --git a/src/writer/spirv/builder_switch_test.cc b/src/writer/spirv/builder_switch_test.cc
index c8d7be0..4ace391 100644
--- a/src/writer/spirv/builder_switch_test.cc
+++ b/src/writer/spirv/builder_switch_test.cc
@@ -45,7 +45,7 @@
// switch (1) {
// }
auto* cond = create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1));
+ create<ast::SintLiteral>(Source{}, &i32, 1));
ast::SwitchStatement expr(cond, ast::CaseStatementList{});
@@ -97,19 +97,19 @@
case_1_body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1))));
+ create<ast::SintLiteral>(Source{}, &i32, 1))));
auto* case_2_body = create<ast::BlockStatement>();
case_2_body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))));
+ create<ast::SintLiteral>(Source{}, &i32, 2))));
ast::CaseSelectorList selector_1;
- selector_1.push_back(create<ast::SintLiteral>(&i32, 1));
+ selector_1.push_back(create<ast::SintLiteral>(Source{}, &i32, 1));
ast::CaseSelectorList selector_2;
- selector_2.push_back(create<ast::SintLiteral>(&i32, 2));
+ selector_2.push_back(create<ast::SintLiteral>(Source{}, &i32, 2));
ast::CaseStatementList cases;
cases.push_back(create<ast::CaseStatement>(selector_1, case_1_body));
@@ -191,7 +191,7 @@
default_body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1))));
+ create<ast::SintLiteral>(Source{}, &i32, 1))));
ast::CaseStatementList cases;
cases.push_back(create<ast::CaseStatement>(default_body));
@@ -270,26 +270,26 @@
case_1_body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1))));
+ create<ast::SintLiteral>(Source{}, &i32, 1))));
auto* case_2_body = create<ast::BlockStatement>();
case_2_body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))));
+ create<ast::SintLiteral>(Source{}, &i32, 2))));
auto* default_body = create<ast::BlockStatement>();
default_body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3))));
+ create<ast::SintLiteral>(Source{}, &i32, 3))));
ast::CaseSelectorList selector_1;
- selector_1.push_back(create<ast::SintLiteral>(&i32, 1));
+ selector_1.push_back(create<ast::SintLiteral>(Source{}, &i32, 1));
ast::CaseSelectorList selector_2;
- selector_2.push_back(create<ast::SintLiteral>(&i32, 2));
- selector_2.push_back(create<ast::SintLiteral>(&i32, 3));
+ selector_2.push_back(create<ast::SintLiteral>(Source{}, &i32, 2));
+ selector_2.push_back(create<ast::SintLiteral>(Source{}, &i32, 3));
ast::CaseStatementList cases;
cases.push_back(create<ast::CaseStatement>(selector_1, case_1_body));
@@ -379,26 +379,26 @@
case_1_body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1))));
+ create<ast::SintLiteral>(Source{}, &i32, 1))));
case_1_body->append(create<ast::FallthroughStatement>());
auto* case_2_body = create<ast::BlockStatement>();
case_2_body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 2))));
+ create<ast::SintLiteral>(Source{}, &i32, 2))));
auto* default_body = create<ast::BlockStatement>();
default_body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 3))));
+ create<ast::SintLiteral>(Source{}, &i32, 3))));
ast::CaseSelectorList selector_1;
- selector_1.push_back(create<ast::SintLiteral>(&i32, 1));
+ selector_1.push_back(create<ast::SintLiteral>(Source{}, &i32, 1));
ast::CaseSelectorList selector_2;
- selector_2.push_back(create<ast::SintLiteral>(&i32, 2));
+ selector_2.push_back(create<ast::SintLiteral>(Source{}, &i32, 2));
ast::CaseStatementList cases;
cases.push_back(create<ast::CaseStatement>(selector_1, case_1_body));
@@ -484,11 +484,11 @@
case_1_body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1))));
+ create<ast::SintLiteral>(Source{}, &i32, 1))));
case_1_body->append(create<ast::FallthroughStatement>());
ast::CaseSelectorList selector_1;
- selector_1.push_back(create<ast::SintLiteral>(&i32, 1));
+ selector_1.push_back(create<ast::SintLiteral>(Source{}, &i32, 1));
ast::CaseStatementList cases;
cases.push_back(create<ast::CaseStatement>(selector_1, case_1_body));
@@ -545,19 +545,19 @@
if_body->append(create<ast::BreakStatement>());
auto* case_1_body = create<ast::BlockStatement>();
- case_1_body->append(
- create<ast::IfStatement>(Source{},
- create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, true)),
- if_body, ast::ElseStatementList{}));
+ case_1_body->append(create<ast::IfStatement>(
+ Source{},
+ create<ast::ScalarConstructorExpression>(
+ create<ast::BoolLiteral>(Source{}, &bool_type, true)),
+ if_body, ast::ElseStatementList{}));
case_1_body->append(create<ast::AssignmentStatement>(
create<ast::IdentifierExpression>(mod->RegisterSymbol("v"), "v"),
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1))));
+ create<ast::SintLiteral>(Source{}, &i32, 1))));
ast::CaseSelectorList selector_1;
- selector_1.push_back(create<ast::SintLiteral>(&i32, 1));
+ selector_1.push_back(create<ast::SintLiteral>(Source{}, &i32, 1));
ast::CaseStatementList cases;
cases.push_back(create<ast::CaseStatement>(selector_1, case_1_body));
diff --git a/src/writer/spirv/builder_unary_op_expression_test.cc b/src/writer/spirv/builder_unary_op_expression_test.cc
index 2579b87..ab14418 100644
--- a/src/writer/spirv/builder_unary_op_expression_test.cc
+++ b/src/writer/spirv/builder_unary_op_expression_test.cc
@@ -42,7 +42,7 @@
ast::UnaryOpExpression expr(ast::UnaryOp::kNegation,
create<ast::ScalarConstructorExpression>(
- create<ast::SintLiteral>(&i32, 1)));
+ create<ast::SintLiteral>(Source{}, &i32, 1)));
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
@@ -59,9 +59,10 @@
TEST_F(BuilderTest, UnaryOp_Negation_Float) {
ast::type::F32 f32;
- ast::UnaryOpExpression expr(ast::UnaryOp::kNegation,
- create<ast::ScalarConstructorExpression>(
- create<ast::FloatLiteral>(&f32, 1)));
+ ast::UnaryOpExpression expr(
+ ast::UnaryOp::kNegation,
+ create<ast::ScalarConstructorExpression>(
+ create<ast::FloatLiteral>(Source{}, &f32, 1)));
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
@@ -78,9 +79,10 @@
TEST_F(BuilderTest, UnaryOp_Not) {
ast::type::Bool bool_type;
- ast::UnaryOpExpression expr(ast::UnaryOp::kNot,
- create<ast::ScalarConstructorExpression>(
- create<ast::BoolLiteral>(&bool_type, false)));
+ ast::UnaryOpExpression expr(
+ ast::UnaryOp::kNot,
+ create<ast::ScalarConstructorExpression>(
+ create<ast::BoolLiteral>(Source{}, &bool_type, false)));
ASSERT_TRUE(td.DetermineResultType(&expr)) << td.error();
diff --git a/src/writer/wgsl/generator_impl_array_accessor_test.cc b/src/writer/wgsl/generator_impl_array_accessor_test.cc
index 034051d..06c7619 100644
--- a/src/writer/wgsl/generator_impl_array_accessor_test.cc
+++ b/src/writer/wgsl/generator_impl_array_accessor_test.cc
@@ -32,7 +32,7 @@
TEST_F(WgslGeneratorImplTest, EmitExpression_ArrayAccessor) {
ast::type::I32 i32;
- auto* lit = create<ast::SintLiteral>(&i32, 5);
+ auto* lit = create<ast::SintLiteral>(Source{}, &i32, 5);
auto* idx = create<ast::ScalarConstructorExpression>(lit);
auto* ary =
create<ast::IdentifierExpression>(mod.RegisterSymbol("ary"), "ary");
diff --git a/src/writer/wgsl/generator_impl_case_test.cc b/src/writer/wgsl/generator_impl_case_test.cc
index b23348f..1a1a444 100644
--- a/src/writer/wgsl/generator_impl_case_test.cc
+++ b/src/writer/wgsl/generator_impl_case_test.cc
@@ -37,7 +37,7 @@
body->append(create<ast::BreakStatement>());
ast::CaseSelectorList lit;
- lit.push_back(create<ast::SintLiteral>(&i32, 5));
+ lit.push_back(create<ast::SintLiteral>(Source{}, &i32, 5));
ast::CaseStatement c(lit, body);
gen.increment_indent();
@@ -56,8 +56,8 @@
body->append(create<ast::BreakStatement>());
ast::CaseSelectorList lit;
- lit.push_back(create<ast::SintLiteral>(&i32, 5));
- lit.push_back(create<ast::SintLiteral>(&i32, 6));
+ lit.push_back(create<ast::SintLiteral>(Source{}, &i32, 5));
+ lit.push_back(create<ast::SintLiteral>(Source{}, &i32, 6));
ast::CaseStatement c(lit, body);
gen.increment_indent();
diff --git a/src/writer/wgsl/generator_impl_constructor_test.cc b/src/writer/wgsl/generator_impl_constructor_test.cc
index 14da9a1..f945e55 100644
--- a/src/writer/wgsl/generator_impl_constructor_test.cc
+++ b/src/writer/wgsl/generator_impl_constructor_test.cc
@@ -37,7 +37,7 @@
TEST_F(WgslGeneratorImplTest, EmitConstructor_Bool) {
ast::type::Bool bool_type;
- auto* lit = create<ast::BoolLiteral>(&bool_type, false);
+ auto* lit = create<ast::BoolLiteral>(Source{}, &bool_type, false);
ast::ScalarConstructorExpression expr(lit);
ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error();
@@ -46,7 +46,7 @@
TEST_F(WgslGeneratorImplTest, EmitConstructor_Int) {
ast::type::I32 i32;
- auto* lit = create<ast::SintLiteral>(&i32, -12345);
+ auto* lit = create<ast::SintLiteral>(Source{}, &i32, -12345);
ast::ScalarConstructorExpression expr(lit);
ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error();
@@ -55,7 +55,7 @@
TEST_F(WgslGeneratorImplTest, EmitConstructor_UInt) {
ast::type::U32 u32;
- auto* lit = create<ast::UintLiteral>(&u32, 56779);
+ auto* lit = create<ast::UintLiteral>(Source{}, &u32, 56779);
ast::ScalarConstructorExpression expr(lit);
ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error();
@@ -65,8 +65,8 @@
TEST_F(WgslGeneratorImplTest, EmitConstructor_Float) {
ast::type::F32 f32;
// Use a number close to 1<<30 but whose decimal representation ends in 0.
- auto* lit =
- create<ast::FloatLiteral>(&f32, static_cast<float>((1 << 30) - 4));
+ auto* lit = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>((1 << 30) - 4));
ast::ScalarConstructorExpression expr(lit);
ASSERT_TRUE(gen.EmitConstructor(&expr)) << gen.error();
@@ -76,7 +76,7 @@
TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Float) {
ast::type::F32 f32;
- auto* lit = create<ast::FloatLiteral>(&f32, -1.2e-5);
+ auto* lit = create<ast::FloatLiteral>(Source{}, &f32, -1.2e-5);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit));
@@ -89,7 +89,7 @@
TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Bool) {
ast::type::Bool b;
- auto* lit = create<ast::BoolLiteral>(&b, true);
+ auto* lit = create<ast::BoolLiteral>(Source{}, &b, true);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit));
@@ -102,7 +102,7 @@
TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Int) {
ast::type::I32 i32;
- auto* lit = create<ast::SintLiteral>(&i32, -12345);
+ auto* lit = create<ast::SintLiteral>(Source{}, &i32, -12345);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit));
@@ -115,7 +115,7 @@
TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Uint) {
ast::type::U32 u32;
- auto* lit = create<ast::UintLiteral>(&u32, 12345);
+ auto* lit = create<ast::UintLiteral>(Source{}, &u32, 12345);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit));
@@ -129,9 +129,9 @@
ast::type::F32 f32;
ast::type::Vector vec(&f32, 3);
- auto* lit1 = create<ast::FloatLiteral>(&f32, 1.f);
- auto* lit2 = create<ast::FloatLiteral>(&f32, 2.f);
- auto* lit3 = create<ast::FloatLiteral>(&f32, 3.f);
+ auto* lit1 = create<ast::FloatLiteral>(Source{}, &f32, 1.f);
+ auto* lit2 = create<ast::FloatLiteral>(Source{}, &f32, 2.f);
+ auto* lit3 = create<ast::FloatLiteral>(Source{}, &f32, 3.f);
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit1));
values.push_back(create<ast::ScalarConstructorExpression>(lit2));
@@ -152,10 +152,10 @@
ast::ExpressionList mat_values;
for (size_t i = 0; i < 3; i++) {
- auto* lit1 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(1 + (i * 2)));
- auto* lit2 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(2 + (i * 2)));
+ auto* lit1 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(1 + (i * 2)));
+ auto* lit2 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(2 + (i * 2)));
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit1));
@@ -179,12 +179,12 @@
ast::ExpressionList ary_values;
for (size_t i = 0; i < 3; i++) {
- auto* lit1 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(1 + (i * 3)));
- auto* lit2 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(2 + (i * 3)));
- auto* lit3 =
- create<ast::FloatLiteral>(&f32, static_cast<float>(3 + (i * 3)));
+ auto* lit1 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(1 + (i * 3)));
+ auto* lit2 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(2 + (i * 3)));
+ auto* lit3 = create<ast::FloatLiteral>(Source{}, &f32,
+ static_cast<float>(3 + (i * 3)));
ast::ExpressionList values;
values.push_back(create<ast::ScalarConstructorExpression>(lit1));
diff --git a/src/writer/wgsl/generator_impl_switch_test.cc b/src/writer/wgsl/generator_impl_switch_test.cc
index 732998f..dfa38af 100644
--- a/src/writer/wgsl/generator_impl_switch_test.cc
+++ b/src/writer/wgsl/generator_impl_switch_test.cc
@@ -38,7 +38,7 @@
ast::type::I32 i32;
ast::CaseSelectorList case_val;
- case_val.push_back(create<ast::SintLiteral>(&i32, 5));
+ case_val.push_back(create<ast::SintLiteral>(Source{}, &i32, 5));
auto* case_body = create<ast::BlockStatement>();
case_body->append(create<ast::BreakStatement>());