@@ -86,7 +86,7 @@ get_source_expressions <- function(filename, lines = NULL) {
8686 source_expression $ content <- get_content(source_expression $ lines )
8787 parsed_content <- get_source_expression(source_expression , error = function (e ) lint_parse_error(e , source_expression ))
8888
89- if (inherits( e , " lint " ) && (is.na(e $ line ) || ! nzchar(e $ line ) || e $ message == " unexpected end of input" )) {
89+ if (is_lint( e ) && (is.na(e $ line ) || ! nzchar(e $ line ) || e $ message == " unexpected end of input" )) {
9090 # Don't create expression list if it's unreliable (invalid encoding or unhandled parse error)
9191 expressions <- list ()
9292 } else {
@@ -502,7 +502,7 @@ get_source_expression <- function(source_expression, error = identity) {
502502 error = error
503503 )
504504
505- if (inherits (parsed_content , c( " error " , " lint " ) )) {
505+ if (is_error (parsed_content ) || is_lint( parsed_content )) {
506506 assign(" e" , parsed_content , envir = parent.frame())
507507 parse_error <- TRUE
508508 }
@@ -513,7 +513,7 @@ get_source_expression <- function(source_expression, error = identity) {
513513 error = error
514514 )
515515
516- if (inherits (parsed_content , c( " error " , " lint " ) )) {
516+ if (is_error (parsed_content ) || is_lint( parsed_content )) {
517517 # Let parse errors take precedence over encoding problems
518518 if (! parse_error ) assign(" e" , parsed_content , envir = parent.frame())
519519 return () # parsed_content is unreliable if encoding is invalid
0 commit comments