Skip to content

Commit

Permalink
wdte: Don't Ignore Errors in Ignored Chain Sections (#177)
Browse files Browse the repository at this point in the history
* wdte: Don't ignore errors in ignored chain sections.

Closes #174.

* wdte: Update some dependencies.
  • Loading branch information
DeedleFake committed Jan 8, 2019
1 parent 4d08a33 commit 106ba4e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module github.com/DeedleFake/wdte

require (
github.com/mattn/go-runewidth v0.0.4 // indirect
github.com/peterh/liner v1.1.0
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9
golang.org/x/sys v0.0.0-20181206074257-70b957f3b65e // indirect
golang.org/x/crypto v0.0.0-20190103213133-ff983b9c42bc
golang.org/x/sys v0.0.0-20190108104531-7fbe1cd0fcc2 // indirect
)
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
github.com/mattn/go-runewidth v0.0.3 h1:a+kO+98RDGEfo6asOGMmpodZq4FNtnGP54yps8BzLR4=
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/peterh/liner v1.1.0 h1:f+aAedNJA6uk7+6rXsYBnhdo4Xux7ESLe+kcuVUF5os=
github.com/peterh/liner v1.1.0/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 h1:mKdxBk7AujPs8kU4m80U72y/zjbZ3UcXC7dClwKbUI0=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/sys v0.0.0-20181206074257-70b957f3b65e h1:njOxP/wVblhCLIUhjHXf6X+dzTt5OQ3vMQo9mkOIKIo=
golang.org/x/sys v0.0.0-20181206074257-70b957f3b65e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/crypto v0.0.0-20190103213133-ff983b9c42bc h1:F5tKCVGp+MUAHhKp5MZtGqAlGX3+oCsiL1Q629FL90M=
golang.org/x/crypto v0.0.0-20190103213133-ff983b9c42bc/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/sys v0.0.0-20190108104531-7fbe1cd0fcc2 h1:ku9Kvp2ZBWAz3GyvuUH3UV1bZCd7RxH0Qf1epWfIDKc=
golang.org/x/sys v0.0.0-20190108104531-7fbe1cd0fcc2/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
2 changes: 1 addition & 1 deletion wdte.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ func (f Chain) Call(frame Frame, args ...Func) Func { // nolint

slotScope, tmp = cur.AssignFunc(frame, slotScope, cur.Slots, tmp)

if cur.Flags&IgnoredChain == 0 {
if _, ok := tmp.(error); ok || (cur.Flags&IgnoredChain == 0) {
prev = tmp
}
}
Expand Down
5 changes: 5 additions & 0 deletions wdte_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ func TestBasics(t *testing.T) {
script: `1 -| 'Not broken yet.' -> a -> + 3 -| 'It broke.' -| 'Or did it?';`,
ret: wdte.String("It broke."),
},
{
name: "Chain/Error/Ignored",
script: `1 -- a -> + 3 -| 'It broke.';`,
ret: wdte.String("It broke."),
},
{
name: "Fib",
script: `let main n => n { <= 1 => n; true => + (main (- n 2)) (main (- n 1)); }; main 12;`,
Expand Down

0 comments on commit 106ba4e

Please sign in to comment.