change all expression and statement pointers to be const (#449)

* change all expression and statement pointers to be const

* const in paren tests
This commit is contained in:
Jeremy G. Siek
2021-04-19 21:47:19 -04:00
committed by GitHub
parent 153d92b390
commit 34f1a03f7b
21 changed files with 258 additions and 229 deletions
+8 -7
View File
@@ -127,10 +127,11 @@ struct StructDeclaration {
struct ChoiceDeclaration {
int line_num;
std::string name;
std::list<std::pair<std::string, Expression*>> alternatives;
std::list<std::pair<std::string, const Expression*>> alternatives;
ChoiceDeclaration(int line_num, std::string name,
std::list<std::pair<std::string, Expression*>> alternatives)
ChoiceDeclaration(
int line_num, std::string name,
std::list<std::pair<std::string, const Expression*>> alternatives)
: line_num(line_num), name(name), alternatives(alternatives) {}
void Print() const;
@@ -143,8 +144,8 @@ struct ChoiceDeclaration {
// Global variable definition implements the Declaration concept.
class VariableDeclaration {
public:
VariableDeclaration(int source_location, std::string name, Expression* type,
Expression* initializer)
VariableDeclaration(int source_location, std::string name,
const Expression* type, const Expression* initializer)
: source_location(source_location),
name(name),
type(type),
@@ -159,8 +160,8 @@ class VariableDeclaration {
private:
int source_location;
std::string name;
Expression* type;
Expression* initializer;
const Expression* type;
const Expression* initializer;
};
} // namespace Carbon