aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lilley <ianlilleyt@gmail.com>2022-08-12 13:48:58 -0400
committerIan Lilley <ianlilleyt@gmail.com>2022-08-12 13:48:58 -0400
commitd5643374d4da1206b4831fddaf21710b482bb913 (patch)
tree362b2ff0d0b7c217bcd87481f86c524a6b3b82e0
parent1063fa3a6556bc15f374318d901e68e16526a14f (diff)
get node length for paren expressions
-rw-r--r--src/odin/printer/visit.odin4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/odin/printer/visit.odin b/src/odin/printer/visit.odin
index f6c39f5..acc9021 100644
--- a/src/odin/printer/visit.odin
+++ b/src/odin/printer/visit.odin
@@ -1858,8 +1858,10 @@ get_node_length :: proc(node: ^ast.Node) -> int {
return strings.rune_count(v.field.name) + 1
case ^ast.Binary_Expr:
return 0
+ case ^ast.Paren_Expr:
+ return 1 + get_node_length(v.expr) + 1
case ^ast.Selector_Expr:
- return get_node_length(v.expr) + strings.rune_count(v.op.text) + strings.rune_count(v.field.name)
+ return get_node_length(v.expr) + strings.rune_count(v.op.text) + strings.rune_count(v.field.name)
case:
panic(fmt.aprintf("unhandled get_node_length case %v", node.derived))
}