we needn't execute L131 "call_map->Set(arg, new_arg)", because when arg
is CallNode and root->args[i] is not CallNode, new_arg will be a null
pointer. There is no point in caching null pointer.
Signed-off-by: windclarion <windclarion@gmail.com>
Array<Expr> new_args;
for (const auto& arg : pattern->args) {
Expr new_arg;
- if (arg->IsInstance<CallNode>()) {
+ if (arg->IsInstance<CallNode>() && root->args[i]->IsInstance<CallNode>()) {
new_arg =
ExtractPattern(Downcast<Call>(arg), Downcast<Call>(root->args[i]), var_map, call_map);
// if we've already processed this call node, return the previous result