[ir] Mark const variable as skipped.
The const variables should all have been const-eval'd and turned into `constants` at the usage sites. This CL updates the IR to skip constants when emitting. A TODO is added to validate they aren't used when identifier expressions are supported. Bug: tint:1718 Change-Id: I77328a0cbd3d7f6692d1d1057d6953fcf762cfd7 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129240 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
5aa7ef2bc0
commit
5b541ff3c2
|
@ -25,6 +25,7 @@
|
|||
#include "src/tint/ast/break_statement.h"
|
||||
#include "src/tint/ast/call_expression.h"
|
||||
#include "src/tint/ast/call_statement.h"
|
||||
#include "src/tint/ast/const.h"
|
||||
#include "src/tint/ast/const_assert.h"
|
||||
#include "src/tint/ast/continue_statement.h"
|
||||
#include "src/tint/ast/discard_statement.h"
|
||||
|
@ -602,9 +603,15 @@ void BuilderImpl::EmitVariable(const ast::Variable* var) {
|
|||
"found an `Override` variable. The SubstituteOverrides "
|
||||
"transform must be run before converting to IR");
|
||||
},
|
||||
// [&](const ast::Const* c) {
|
||||
// TODO(dsinclair): Implement
|
||||
// },
|
||||
[&](const ast::Const*) {
|
||||
// Skip. This should be handled by const-eval already, so the const will be a
|
||||
// `constant::` value at the usage sites. Can just ignore the `const` variable as it
|
||||
// should never be used.
|
||||
//
|
||||
// TODO(dsinclair): Probably want to store the const variable somewhere and then in
|
||||
// identifier expression log an error if we ever see a const identifier. Add this when
|
||||
// identifiers and variables are supported.
|
||||
},
|
||||
[&](Default) {
|
||||
add_error(var->source, "unknown variable: " + std::string(var->TypeInfo().name));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue