2024-02-24 21:00:04 +00:00
|
|
|
package otto
|
|
|
|
|
2024-04-04 14:46:14 +00:00
|
|
|
type resultKind int
|
2024-02-24 21:00:04 +00:00
|
|
|
|
|
|
|
const (
|
2024-04-04 14:46:14 +00:00
|
|
|
_ resultKind = iota
|
2024-02-24 21:00:04 +00:00
|
|
|
resultReturn
|
|
|
|
resultBreak
|
|
|
|
resultContinue
|
|
|
|
)
|
|
|
|
|
2024-04-04 14:46:14 +00:00
|
|
|
type result struct {
|
|
|
|
kind resultKind
|
2024-02-24 21:00:04 +00:00
|
|
|
value Value
|
|
|
|
target string
|
|
|
|
}
|
|
|
|
|
2024-04-04 14:46:14 +00:00
|
|
|
func newReturnResult(value Value) result {
|
|
|
|
return result{resultReturn, value, ""}
|
2024-02-24 21:00:04 +00:00
|
|
|
}
|
|
|
|
|
2024-04-04 14:46:14 +00:00
|
|
|
func newContinueResult(target string) result {
|
|
|
|
return result{resultContinue, emptyValue, target}
|
2024-02-24 21:00:04 +00:00
|
|
|
}
|
|
|
|
|
2024-04-04 14:46:14 +00:00
|
|
|
func newBreakResult(target string) result {
|
|
|
|
return result{resultBreak, emptyValue, target}
|
2024-02-24 21:00:04 +00:00
|
|
|
}
|