diff options
Diffstat (limited to 'cli/tools/repl.rs')
-rw-r--r-- | cli/tools/repl.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cli/tools/repl.rs b/cli/tools/repl.rs index 8cde1e39c..b86e8ccd8 100644 --- a/cli/tools/repl.rs +++ b/cli/tools/repl.rs @@ -29,6 +29,7 @@ use std::borrow::Cow; use std::cell::RefCell; use std::path::PathBuf; use std::sync::Arc; +use swc_ecmascript::parser::error::SyntaxError; use swc_ecmascript::parser::token::{Token, Word}; use tokio::sync::mpsc::channel; use tokio::sync::mpsc::unbounded_channel; @@ -257,6 +258,17 @@ impl Validator for EditorHelper { } } } + Token::Error(error) => { + match error.kind() { + // If there is unterminated template, it continues to read input. + SyntaxError::UnterminatedTpl => {} + _ => { + // If it failed parsing, it should be V8's task to output error instead. + // Thus marked as valid with no info. + return Ok(ValidationResult::Valid(None)); + } + } + } _ => {} } } |