node: implement UnaryPlus/UnaryMinus
This commit is contained in:
parent
3c76a68843
commit
8af07570cd
16
node.go
16
node.go
@ -1275,6 +1275,22 @@ func (this *conversionState) convertNoFreeFloating(n_ node.Node) (string, error)
|
|||||||
|
|
||||||
return v + "++", nil
|
return v + "++", nil
|
||||||
|
|
||||||
|
case *expr.UnaryMinus:
|
||||||
|
v, err := this.convert(n.Expr)
|
||||||
|
if err != nil {
|
||||||
|
return "", parseErr{n, err}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "-(" + v + ")", nil
|
||||||
|
|
||||||
|
case *expr.UnaryPlus:
|
||||||
|
v, err := this.convert(n.Expr)
|
||||||
|
if err != nil {
|
||||||
|
return "", parseErr{n, err}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "+(" + v + ")", nil
|
||||||
|
|
||||||
case *expr.MethodCall:
|
case *expr.MethodCall:
|
||||||
// Foo->Bar(Baz)
|
// Foo->Bar(Baz)
|
||||||
parent, err := this.convert(n.Variable)
|
parent, err := this.convert(n.Variable)
|
||||||
|
Loading…
Reference in New Issue
Block a user