Closed jackfirth closed 2 years ago
Saw this code today:
(cond [(< (length stack) 2) (raise-read-error "parser: Cannot continue after error" #f #f #f #f #f)] [else (set! stack (cdr stack)) (remove-states)])
Assuming the enclosing context is an internal definition context, that can be refactored to use when instead:
when
(when (< (length stack) 2) (raise-read-error "parser: Cannot continue after error" #f #f #f #f #f)) (set! stack (cdr stack)) (remove-states)
This can be detected with the help of an always-throws syntax class of some sort that matched calls to functions like raise-read-error, raise-syntax-error, raise-arguments-error, etc.
always-throws
raise-read-error
raise-syntax-error
raise-arguments-error
Oops, that commit didn't close this issue, it closed #157.
Saw this code today:
Assuming the enclosing context is an internal definition context, that can be refactored to use
when
instead:This can be detected with the help of an
always-throws
syntax class of some sort that matched calls to functions likeraise-read-error
,raise-syntax-error
,raise-arguments-error
, etc.