diff --git a/packages/core/src/runtime/pattern.ts b/packages/core/src/runtime/pattern.ts index 6f3c86d..f2040b1 100644 --- a/packages/core/src/runtime/pattern.ts +++ b/packages/core/src/runtime/pattern.ts @@ -214,7 +214,7 @@ export function lit(v: AnyValue): P.Pattern { return P.Pattern.lit(P.asAnyAtom(v)); } -export function drop_lit(p: P.Pattern): AnyValue | null { +export function drop_lit(p: P.Pattern, strip_binds = false): AnyValue | null { const e = new Error(); function walkEntries(target: AnyValue[], entries: EncodableDictionary>): void { @@ -253,6 +253,11 @@ export function drop_lit(p: P.Pattern): AnyValue | null { } case 'lit': return P.fromAnyAtom(p.value); + case 'bind': + if (strip_binds) { + return walk(p.pattern); + } + // fall through default: throw e; }