Switching to ML style type annotations. not separate statement from the expression
This commit is contained in:
parent
6acec5641c
commit
f3c3a76671
6 changed files with 35 additions and 36 deletions
|
|
@ -325,9 +325,9 @@ export function prettyPrint(ast: AST, indent = 0): string {
|
|||
|
||||
case 'definition':
|
||||
const ann = ast.annotation
|
||||
? `${ast.name} : ${prettyPrintType(ast.annotation.type)};\n`
|
||||
? ` : ${prettyPrintType(ast.annotation.type)}`
|
||||
: '';
|
||||
return `${ann}${ast.name} = ${prettyPrint(ast.body, indent)};`;
|
||||
return `${ast.name}${ann} = ${prettyPrint(ast.body, indent)};`;
|
||||
|
||||
default:
|
||||
return `Unknown AST kind: ${i}${(ast as any).kind}`
|
||||
|
|
@ -373,7 +373,7 @@ function prettyPrintPattern(pattern: Pattern): string {
|
|||
}
|
||||
}
|
||||
|
||||
function prettyPrintType(type: TypeAST): string {
|
||||
export function prettyPrintType(type: TypeAST): string {
|
||||
switch (type.kind) {
|
||||
case 'type-name':
|
||||
case 'type-var':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue