Add a symbol to the Identifier AST node
This CL adds a Symbol to the identifier to represent the name. The name
still exists but will be removed in a future CL when the namers are in
place.
Change-Id: Ic3cc8ad0d99e3bea6eb1ff1ce212e7de67991aec
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35460
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/ast/identifier_expression.h b/src/ast/identifier_expression.h
index 703c041..9fa2660 100644
--- a/src/ast/identifier_expression.h
+++ b/src/ast/identifier_expression.h
@@ -21,6 +21,7 @@
#include "src/ast/expression.h"
#include "src/ast/intrinsic.h"
+#include "src/symbol.h"
namespace tint {
namespace ast {
@@ -29,16 +30,22 @@
class IdentifierExpression : public Castable<IdentifierExpression, Expression> {
public:
/// Constructor
+ /// @param sym the symbol for the identifier
/// @param name the name
- explicit IdentifierExpression(const std::string& name);
+ explicit IdentifierExpression(Symbol sym, const std::string& name);
/// Constructor
/// @param source the source
+ /// @param sym the symbol for the identifier
/// @param name the name
- IdentifierExpression(const Source& source, const std::string& name);
+ IdentifierExpression(const Source& source,
+ Symbol sym,
+ const std::string& name);
/// Move constructor
IdentifierExpression(IdentifierExpression&&);
~IdentifierExpression() override;
+ /// @returns the symbol for the identifier
+ Symbol symbol() const { return sym_; }
/// @returns the name part of the identifier
std::string name() const { return name_; }
@@ -82,6 +89,7 @@
Intrinsic intrinsic_ = Intrinsic::kNone;
std::unique_ptr<intrinsic::Signature> intrinsic_sig_;
+ Symbol sym_;
std::string name_;
};