Skip to content

Commit 75145b7

Browse files
authored
[NFC] Add more const annotations + a trivial == (#6216)
1 parent 1850199 commit 75145b7

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/ir/possible-constant.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ struct PossibleConstantValues {
4848
public:
4949
PossibleConstantValues() : value(None()) {}
5050

51+
bool operator==(const PossibleConstantValues& other) const {
52+
return value == other.value;
53+
}
54+
5155
// Notes the contents of an expression and update our internal knowledge based
5256
// on it and all previous values noted.
5357
void note(Expression* expr, Module& wasm) {
@@ -155,7 +159,7 @@ struct PossibleConstantValues {
155159
}
156160

157161
// Assuming we have a single value, make an expression containing that value.
158-
Expression* makeExpression(Module& wasm) {
162+
Expression* makeExpression(Module& wasm) const {
159163
Builder builder(wasm);
160164
if (isConstantLiteral()) {
161165
return builder.makeConstantExpression(getConstantLiteral());

src/ir/subtypes.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ struct SubTypes {
145145
// Efficiently iterate on subtypes of a type, up to a particular depth (depth
146146
// 0 means not to traverse subtypes, etc.). The callback function receives
147147
// (type, depth).
148-
template<typename F> void iterSubTypes(HeapType type, Index depth, F func) {
148+
template<typename F>
149+
void iterSubTypes(HeapType type, Index depth, F func) const {
149150
// Start by traversing the type itself.
150151
func(type, 0);
151152

@@ -186,7 +187,7 @@ struct SubTypes {
186187
}
187188

188189
// As above, but iterate to the maximum depth.
189-
template<typename F> void iterSubTypes(HeapType type, F func) {
190+
template<typename F> void iterSubTypes(HeapType type, F func) const {
190191
return iterSubTypes(type, std::numeric_limits<Index>::max(), func);
191192
}
192193

0 commit comments

Comments
 (0)