parsing record access and update
This commit is contained in:
parent
6e8b5afd3b
commit
b6f7e63e49
3 changed files with 48 additions and 3 deletions
|
|
@ -158,6 +158,13 @@ export function prettyPrint(ast: AST, indent = 0): string {
|
|||
const params = ast.params.join(', ')
|
||||
return `${i}(${params}) => ${prettyPrint(ast.body)}`
|
||||
|
||||
case 'record-access':
|
||||
return `${i}${prettyPrint(ast.record)}.${ast.field}`
|
||||
|
||||
case 'record-update':
|
||||
const updates = Object.entries(ast.updates).map(([k, v]) => `${k} = ${prettyPrint(v, 0)}`).join(', ');
|
||||
return `${i}${prettyPrint(ast.record)} { ${updates} }`
|
||||
|
||||
default:
|
||||
return `${i}${ast.kind}`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue