mirror of
https://github.com/robertkrimen/otto
synced 2025-09-28 18:45:22 +08:00
Fix <return> => <throw>
This commit is contained in:
parent
979a87a79d
commit
0681483ac6
|
@ -283,7 +283,7 @@ func newThrowNode(argument _node) *_throwNode {
|
|||
}
|
||||
|
||||
func (self _throwNode) String() string {
|
||||
return fmt.Sprintf("{ <return> %s }", self.Argument)
|
||||
return fmt.Sprintf("{ <throw> %s }", self.Argument)
|
||||
}
|
||||
|
||||
type _tryCatchNode struct {
|
||||
|
|
|
@ -629,6 +629,15 @@ func TestParseSuccess(t *testing.T) {
|
|||
---
|
||||
{ @ { <var> = abc { <call> { <call> 1 { <function> _ } } _ } } }
|
||||
`)
|
||||
|
||||
test(`
|
||||
xyzzy
|
||||
|
||||
throw new TypeError("Nothing happens.")
|
||||
---
|
||||
{ @ xyzzy { <throw> { <new> TypeError "Nothing happens." } } }
|
||||
`)
|
||||
|
||||
}
|
||||
|
||||
func TestParseFailure(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user