Fix error handling to include thrown voids.

This commit is contained in:
gozala 2016-05-10 09:27:30 -07:00
Родитель 94247d4990
Коммит f1ade5e9db
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: C80F9B292FB470DE
3 изменённых файлов: 13 добавлений и 8 удалений

Просмотреть файл

@ -10,6 +10,7 @@ export type {Text, Key, TagName, DOM}
*/
let driver/*:?Driver*/ = null
const absent = new String("absent")
class VirtualRoot /*::<model, action>*/ {
/*::
@ -29,7 +30,7 @@ class VirtualRoot /*::<model, action>*/ {
this.address = address
}
renderWith(current/*:Driver*/) {
let exception = null
let exception = absent
const previous = driver
driver = current
@ -42,7 +43,7 @@ class VirtualRoot /*::<model, action>*/ {
driver = previous
if (exception != null) {
if (exception != absent) {
throw exception
}
}

Просмотреть файл

@ -18,6 +18,8 @@ let state/*:State*/ = NO_REQUEST
let requests/*:Array<(time:Time) => any>*/ = []
let ids/*:Array<number>*/ = []
const absent = new String("absent")
export const requestAnimationFrame = /*::<a>*/
(request/*:(time:Time) => a*/) => {
if (state === NO_REQUEST) {
@ -76,7 +78,7 @@ const dispatchAnimationFrame = /*::<a>*/
, index/*:number*/
, time/*:Time*/
) => {
let exception = null
let exception = absent
const count = requests.length
try {
while (index < count) {
@ -93,7 +95,7 @@ const dispatchAnimationFrame = /*::<a>*/
dispatchAnimationFrame(requests, index, time)
}
if (exception != null) {
if (exception != absent) {
throw exception
}
}

Просмотреть файл

@ -9,6 +9,8 @@ export type {Signal, Address, Mailbox}
export type {Translate, Reducer, AddressBook}
*/
const absent = new String("absent")
class Input /*::<a>*/ {
/*::
$type: "Signal.Signal";
@ -29,7 +31,7 @@ class Input /*::<a>*/ {
}
}
static notify(message/*:a*/, addressBook/*:AddressBook<a>*/, from/*:number*/, to/*:number*/)/*:void*/ {
let exception = null
let exception = absent
try {
while (from < to) {
const address = addressBook[from]
@ -47,7 +49,7 @@ class Input /*::<a>*/ {
Input.notify(message, addressBook, from + 1, to)
}
if (exception != null) {
if (exception != absent) {
throw exception
}
}
@ -82,7 +84,7 @@ class Input /*::<a>*/ {
this.queue.push(value)
}
} else {
let exception = null
let exception = absent
this.isBlocked = true
try {
this.value = value
@ -101,7 +103,7 @@ class Input /*::<a>*/ {
this.receive(value = this.queue.shift())
}
if (exception != null) {
if (exception != absent) {
throw exception
}
}