Skip to content

Commit

Permalink
Codegen: hole param
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanjermakov committed Mar 25, 2024
1 parent 4bf0736 commit 1a9ddcb
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/codegen/js/expr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,17 @@ export const emitPatternExprCondition = (
}

export const emitParam = (param: Param, module: Module, ctx: Context): EmitNode => {
if (param.pattern.expr.kind !== 'name') {
return jsError('destructuring')
switch (param.pattern.expr.kind) {
case 'name':
return emitToken(param.pattern.expr.value, param.pattern.expr.parseNode)
case 'hole':
return emitToken(nextVariable(ctx))
case 'con-pattern':
// TODO
return emitToken('/*destructuring*/')
default:
return unreachable()
}
return emitToken(param.pattern.expr.value, param.pattern.expr.parseNode)
}

export const emitPattern = (
Expand Down

0 comments on commit 1a9ddcb

Please sign in to comment.