go/ast/astutil: describe fewer CallExprs as "conversions"

Only unary CallExprs with no ellipsis, f(x), are ambiguous.

Change-Id: If4f17445ab0725dee916992db133eac5536133a7
Reviewed-on: https://go-review.googlesource.com/24552
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Alan Donovan 2016-06-28 17:23:16 -04:00
parent 1727758746
commit 0d2bde8553
6 changed files with 9 additions and 6 deletions

View File

@ -206,7 +206,7 @@ Fields:
inner.recursive.E bool inner.recursive.E bool
-------- @describe call-unknown -------- -------- @describe call-unknown --------
function call (or conversion) of type invalid type function call of type invalid type
-------- @describe def-iface-I -------- -------- @describe def-iface-I --------
definition of type I (size 16, align 8) definition of type I (size 16, align 8)

View File

@ -7,7 +7,7 @@
"end": 176 "end": 176
}, },
{ {
"desc": "function call (or conversion)", "desc": "function call",
"start": 175, "start": 175,
"end": 178 "end": 178
}, },

View File

@ -7,7 +7,7 @@ import path: what
-------- @what call -------- -------- @what call --------
identifier identifier
function call (or conversion) function call
expression statement expression statement
block block
function declaration function declaration

View File

@ -509,7 +509,10 @@ func NodeDescription(n ast.Node) string {
return "fall-through statement" return "fall-through statement"
} }
case *ast.CallExpr: case *ast.CallExpr:
return "function call (or conversion)" if len(n.Args) == 1 && !n.Ellipsis.IsValid() {
return "function call (or conversion)"
}
return "function call"
case *ast.CaseClause: case *ast.CaseClause:
return "case clause" return "case clause"
case *ast.ChanType: case *ast.ChanType:

View File

@ -9,7 +9,7 @@
"end": 180 "end": 180
}, },
{ {
"desc": "function call (or conversion)", "desc": "function call",
"start": 179, "start": 179,
"end": 182 "end": 182
}, },

View File

@ -7,7 +7,7 @@ import path: what
-------- @what call -------- -------- @what call --------
identifier identifier
function call (or conversion) function call
expression statement expression statement
block block
function declaration function declaration