Skip to content

Commit 0538b7c

Browse files
committed
(wasm) Small cleanups
1 parent acba247 commit 0538b7c

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

packages/wasm/src/index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -882,13 +882,12 @@ export class Compiler {
882882
return visit(ir.substituteParams(ruleInfo.body, children));
883883
}
884884

885-
if (children.length > 0) {
885+
const specializedName = ir.specializedName(irExp);
886+
if (specializedName !== ruleName) {
886887
// Record this pattern.
887888
const rulePatterns = setdefault(patternsByRule, ruleName, () => new Map());
888-
rulePatterns.set(ir.specializedName(irExp), children);
889+
rulePatterns.set(specializedName, children);
889890
}
890-
891-
const specializedName = ir.specializedName(irExp);
892891
this._ensureRuleId(specializedName);
893892

894893
// If not yet seen, recursively visit the body of the specialized
@@ -1176,7 +1175,7 @@ export class Compiler {
11761175
case 'Param':
11771176
// Fall through (Params should not exist at codegen time).
11781177
default:
1179-
throw new Error(`not handled: ${exp.ruleName}`);
1178+
throw new Error(`not handled: ${exp.type}`);
11801179
}
11811180
});
11821181
asm.popStackFrame();

0 commit comments

Comments
 (0)