node: remove throw ""
-> errors.New("")
transform, as PHP cannot throw scalars
This commit is contained in:
parent
d6cd0e8191
commit
0d7024dbee
10
node.go
10
node.go
@ -355,12 +355,12 @@ func (this *conversionState) convertNoFreeFloating(n_ node.Node) (string, error)
|
||||
// Treat as an err return
|
||||
// FIXME we don't know the default return type for the function we're in
|
||||
|
||||
// If the expr is a string literal, we can convert it to errors.New()
|
||||
// Although we probably can't do this in general for stringly-typed expressions
|
||||
// PHP can only throw objects, not literals/scalars
|
||||
// If the expr is just new Exception, we can convert it to errors.New()
|
||||
|
||||
if str, ok := n.Expr.(*scalar.String); ok {
|
||||
return "return nil, errors.New(" + str.Value + ")\n", nil
|
||||
}
|
||||
//if str, ok := n.Expr.(*scalar.String); ok {
|
||||
// return "return nil, errors.New(" + str.Value + ")\n", nil
|
||||
//}
|
||||
|
||||
child, err := this.convert(n.Expr)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user