mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 17:35:30 +00:00
Store expressions in switch case statements.
This CL moves switch case statements to store Expression instead of an IntLiteralExpression. The SEM is updated to store the materialized constant instead of accessing the expression value directly. Bug: tint:1633 Change-Id: Id79dabb806be1049f775299732bc1c7b1bf0c05f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106300 Commit-Queue: Dan Sinclair <dsinclair@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com> Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
00aa7ef462
commit
d32fbe07e7
@@ -26,6 +26,7 @@ class SwitchStatement;
|
||||
} // namespace tint::ast
|
||||
namespace tint::sem {
|
||||
class CaseStatement;
|
||||
class Constant;
|
||||
class Expression;
|
||||
} // namespace tint::sem
|
||||
|
||||
@@ -82,14 +83,14 @@ class CaseStatement final : public Castable<CaseStatement, CompoundStatement> {
|
||||
const BlockStatement* Body() const { return body_; }
|
||||
|
||||
/// @returns the selectors for the case
|
||||
std::vector<const Expression*>& Selectors() { return selectors_; }
|
||||
std::vector<const Constant*>& Selectors() { return selectors_; }
|
||||
|
||||
/// @returns the selectors for the case
|
||||
const std::vector<const Expression*>& Selectors() const { return selectors_; }
|
||||
const std::vector<const Constant*>& Selectors() const { return selectors_; }
|
||||
|
||||
private:
|
||||
const BlockStatement* body_ = nullptr;
|
||||
std::vector<const Expression*> selectors_;
|
||||
std::vector<const Constant*> selectors_;
|
||||
};
|
||||
|
||||
} // namespace tint::sem
|
||||
|
||||
Reference in New Issue
Block a user