mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
tint: Lex different tokens for float suffixes
Generate different tokens for: • 'f' suffixed float literals • unsuffixed integer literals 'f' and unsuffixed are currently both treated as f32 by the resolver, but this is the first step to supporting abstract floats. Bug: tint:1504 Change-Id: Id3b1fe420b6eb8901f88d6a5de06ef4f54aa3edf Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89031 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
dd5947ff76
commit
41285aa578
@@ -259,7 +259,7 @@ std::map<uint32_t, Scalar> Inspector::GetConstantIDs() {
|
||||
}
|
||||
|
||||
if (auto* l = literal->As<ast::FloatLiteralExpression>()) {
|
||||
result[constant_id] = Scalar(l->value);
|
||||
result[constant_id] = Scalar(static_cast<float>(l->value));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1027,15 +1027,15 @@ TEST_F(InspectorGetConstantIDsTest, Float) {
|
||||
|
||||
ASSERT_TRUE(result.find(20) != result.end());
|
||||
EXPECT_TRUE(result[20].IsFloat());
|
||||
EXPECT_FLOAT_EQ(0.0, result[20].AsFloat());
|
||||
EXPECT_FLOAT_EQ(0.0f, result[20].AsFloat());
|
||||
|
||||
ASSERT_TRUE(result.find(300) != result.end());
|
||||
EXPECT_TRUE(result[300].IsFloat());
|
||||
EXPECT_FLOAT_EQ(-10.0, result[300].AsFloat());
|
||||
EXPECT_FLOAT_EQ(-10.0f, result[300].AsFloat());
|
||||
|
||||
ASSERT_TRUE(result.find(4000) != result.end());
|
||||
EXPECT_TRUE(result[4000].IsFloat());
|
||||
EXPECT_FLOAT_EQ(15.0, result[4000].AsFloat());
|
||||
EXPECT_FLOAT_EQ(15.0f, result[4000].AsFloat());
|
||||
}
|
||||
|
||||
TEST_F(InspectorGetConstantNameToIdMapTest, WithAndWithoutIds) {
|
||||
|
||||
Reference in New Issue
Block a user