mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 01:15:39 +00:00
ast: Remove types from ast::Literals
A literal has an implicit type, so there should be no type on the AST node. This highlighted that the resolver was nto canonicalizing TypeConstructorExpression types, which has been fixed. This required preservation of the declared type name in order for error messages to contain aliased names. Bug: tint:724 Change-Id: I21594a3e8a0fb1b73c6c5b46a14b8664b7f28512 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49345 Reviewed-by: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
0bf0fb9b29
commit
109b18f504
@@ -147,8 +147,7 @@ class InspectorHelper : public ProgramBuilder {
|
||||
void AddConstantID(std::string name, uint32_t id, typ::Type type, T* val) {
|
||||
ast::Expression* constructor = nullptr;
|
||||
if (val) {
|
||||
constructor =
|
||||
create<ast::ScalarConstructorExpression>(MakeLiteral(type, val));
|
||||
constructor = Expr(*val);
|
||||
}
|
||||
GlobalConst(name, type, constructor,
|
||||
ast::DecorationList{
|
||||
@@ -156,34 +155,6 @@ class InspectorHelper : public ProgramBuilder {
|
||||
});
|
||||
}
|
||||
|
||||
/// @param type AST type of the literal, must resolve to BoolLiteral
|
||||
/// @param val scalar value for the literal to contain
|
||||
/// @returns a Literal of the expected type and value
|
||||
ast::Literal* MakeLiteral(typ::Type type, bool* val) {
|
||||
return create<ast::BoolLiteral>(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(typ::Type type, uint32_t* val) {
|
||||
return create<ast::UintLiteral>(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(typ::Type type, int32_t* val) {
|
||||
return create<ast::SintLiteral>(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(typ::Type type, float* val) {
|
||||
return create<ast::FloatLiteral>(type, *val);
|
||||
}
|
||||
|
||||
/// @param vec Vector of StageVariable to be searched
|
||||
/// @param name Name to be searching for
|
||||
/// @returns true if name is in vec, otherwise false
|
||||
|
||||
Reference in New Issue
Block a user