diff options
Diffstat (limited to 'src/ast_utils.h')
-rw-r--r-- | src/ast_utils.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ast_utils.h b/src/ast_utils.h index 2565ee24a..159762d0b 100644 --- a/src/ast_utils.h +++ b/src/ast_utils.h @@ -296,7 +296,7 @@ struct ExpressionManipulator { return ret; } Expression* visitCallIndirect(CallIndirect *curr) { - auto* ret = builder.makeCallIndirect(curr->fullType, curr->target, {}, curr->type); + auto* ret = builder.makeCallIndirect(curr->fullType, copy(curr->target), {}, curr->type); for (Index i = 0; i < curr->operands.size(); i++) { ret->operands.push_back(copy(curr->operands[i])); } @@ -714,6 +714,16 @@ struct ExpressionAnalyzer { continue; } hash(curr->_id); + // we often don't need to hash the type, as it is tied to other values + // we are hashing anyhow, but there are exceptions: for example, a + // get_local's type is determined by the function, so if we are + // hashing only expression fragments, then two from different + // functions may turn out the same even if the type differs. Likewise, + // if we hash between modules, then we need to take int account + // call_imports type, etc. The simplest thing is just to hash the + // type for all of them. + hash(curr->type); + #define PUSH(clazz, what) \ stack.push_back(curr->cast<clazz>()->what); #define HASH(clazz, what) \ |