mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
tint/reader/wgsl: Better diagnostics for missing parentheses
This change required removing the `&&` splitting for `a & b && c` which never valid WGSL (right now). Fixed: tint:1658 Change-Id: Ideb9f1aa9cf9b9b1054a6fc65860106dc072a9dc Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105820 Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: David Neto <dneto@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
b6e1bc7d5d
commit
00aa7ef462
@@ -248,7 +248,53 @@ constexpr const char* FriendlyName(BinaryOp op) {
|
||||
case BinaryOp::kModulo:
|
||||
return "modulo";
|
||||
}
|
||||
return "INVALID";
|
||||
return "<invalid>";
|
||||
}
|
||||
|
||||
/// @returns the WGSL operator of the BinaryOp
|
||||
/// @param op the BinaryOp
|
||||
constexpr const char* Operator(BinaryOp op) {
|
||||
switch (op) {
|
||||
case BinaryOp::kAnd:
|
||||
return "&";
|
||||
case BinaryOp::kOr:
|
||||
return "|";
|
||||
case BinaryOp::kXor:
|
||||
return "^";
|
||||
case BinaryOp::kLogicalAnd:
|
||||
return "&&";
|
||||
case BinaryOp::kLogicalOr:
|
||||
return "||";
|
||||
case BinaryOp::kEqual:
|
||||
return "==";
|
||||
case BinaryOp::kNotEqual:
|
||||
return "!=";
|
||||
case BinaryOp::kLessThan:
|
||||
return "<";
|
||||
case BinaryOp::kGreaterThan:
|
||||
return ">";
|
||||
case BinaryOp::kLessThanEqual:
|
||||
return "<=";
|
||||
case BinaryOp::kGreaterThanEqual:
|
||||
return ">=";
|
||||
case BinaryOp::kShiftLeft:
|
||||
return "<<";
|
||||
case BinaryOp::kShiftRight:
|
||||
return ">>";
|
||||
case BinaryOp::kAdd:
|
||||
return "+";
|
||||
case BinaryOp::kSubtract:
|
||||
return "-";
|
||||
case BinaryOp::kMultiply:
|
||||
return "*";
|
||||
case BinaryOp::kDivide:
|
||||
return "/";
|
||||
case BinaryOp::kModulo:
|
||||
return "%";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "<invalid>";
|
||||
}
|
||||
|
||||
/// @param out the std::ostream to write to
|
||||
|
||||
Reference in New Issue
Block a user