tint: Have ast::IdentifierExpression use ast::Identifier
The additional nesting is somewhat unfortunate for pointer
indirection overhead, but this simplfies logic like
transform::Renamer, which can continue to find all the
identifier nodes in the program.
Bug: tint:1257
Change-Id: I8d51dd80dc4c51ef59238959029b8511f1edf70d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118342
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
diff --git a/src/tint/ast/identifier_expression.h b/src/tint/ast/identifier_expression.h
index b583807..475249c 100644
--- a/src/tint/ast/identifier_expression.h
+++ b/src/tint/ast/identifier_expression.h
@@ -17,6 +17,11 @@
#include "src/tint/ast/expression.h"
+// Forward declarations
+namespace tint::ast {
+class Identifier;
+}
+
namespace tint::ast {
/// An identifier expression
@@ -26,8 +31,11 @@
/// @param pid the identifier of the program that owns this node
/// @param nid the unique node identifier
/// @param src the source of this node
- /// @param sym the symbol for the identifier
- IdentifierExpression(ProgramID pid, NodeID nid, const Source& src, Symbol sym);
+ /// @param identifier the identifier
+ IdentifierExpression(ProgramID pid,
+ NodeID nid,
+ const Source& src,
+ const Identifier* identifier);
/// Move constructor
IdentifierExpression(IdentifierExpression&&);
~IdentifierExpression() override;
@@ -38,8 +46,8 @@
/// @return the newly cloned node
const IdentifierExpression* Clone(CloneContext* ctx) const override;
- /// The symbol for the identifier
- const Symbol symbol;
+ /// The identifier for the expression
+ Identifier const* const identifier;
};
} // namespace tint::ast