1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

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

This commit is contained in:
zakuro
2021-01-13 22:54:41 +09:00
committed by GitHub
parent 245ed9160a
commit 4923048d95

View File

@@ -338,6 +338,12 @@ pub fn (node Stmt) str() string {
BranchStmt {
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 {
return node.expr.str()
}