ast: add case for ConstDecl in `fn (node Stmt) str()` (#8073)

pull/8109/head
zakuro 2021-01-13 22:54:41 +09:00 committed by GitHub
parent 245ed9160a
commit 4923048d95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -338,6 +338,12 @@ pub fn (node Stmt) str() string {
BranchStmt { BranchStmt {
return node.str() return node.str()
} }
ConstDecl {
fields := node.fields.map(fn (f ConstField) string {
return '${f.name.trim_prefix(f.mod + '.')} = $f.expr'
})
return 'const (${fields.join(' ')})'
}
ExprStmt { ExprStmt {
return node.expr.str() return node.expr.str()
} }