summaryrefslogtreecommitdiff
path: root/cli/tools
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tools')
-rw-r--r--cli/tools/coverage.rs2
-rw-r--r--cli/tools/repl.rs4
-rw-r--r--cli/tools/test_runner.rs11
3 files changed, 7 insertions, 10 deletions
diff --git a/cli/tools/coverage.rs b/cli/tools/coverage.rs
index bb1e9417d..62f5f5d2e 100644
--- a/cli/tools/coverage.rs
+++ b/cli/tools/coverage.rs
@@ -432,7 +432,7 @@ impl CoverageReporter for PrettyCoverageReporter {
.map(|source_map| SourceMap::from_slice(&source_map).unwrap());
let mut ignored_spans: Vec<Span> = Vec::new();
- for item in ast::lex("", script_source, &MediaType::JavaScript) {
+ for item in ast::lex(script_source, &MediaType::JavaScript) {
if let TokenOrComment::Token(_) = item.inner {
continue;
}
diff --git a/cli/tools/repl.rs b/cli/tools/repl.rs
index 5b0d78841..d527ea868 100644
--- a/cli/tools/repl.rs
+++ b/cli/tools/repl.rs
@@ -231,7 +231,7 @@ impl Validator for EditorHelper {
let mut stack: Vec<Token> = Vec::new();
let mut in_template = false;
- for item in ast::lex("", ctx.input(), &MediaType::TypeScript) {
+ for item in ast::lex(ctx.input(), &MediaType::TypeScript) {
if let TokenOrComment::Token(token) = item.inner {
match token {
Token::BackQuote => in_template = !in_template,
@@ -302,7 +302,7 @@ impl Highlighter for EditorHelper {
fn highlight<'l>(&self, line: &'l str, _: usize) -> Cow<'l, str> {
let mut out_line = String::from(line);
- for item in ast::lex("", line, &MediaType::TypeScript) {
+ for item in ast::lex(line, &MediaType::TypeScript) {
// Adding color adds more bytes to the string,
// so an offset is needed to stop spans falling out of sync.
let offset = out_line.len() - line.len();
diff --git a/cli/tools/test_runner.rs b/cli/tools/test_runner.rs
index 656db50f4..106555f7d 100644
--- a/cli/tools/test_runner.rs
+++ b/cli/tools/test_runner.rs
@@ -399,7 +399,7 @@ fn extract_files_from_regex_blocks(
let file_specifier = deno_core::resolve_url_or_path(&format!(
"{}${}-{}{}",
- location.filename,
+ location.specifier,
location.line + line_offset,
location.line + line_offset + line_count,
file_media_type.as_ts_extension(),
@@ -425,10 +425,7 @@ fn extract_files_from_source_comments(
media_type: &MediaType,
) -> Result<Vec<File>, AnyError> {
let parsed_module = ast::parse(specifier.as_str(), source, media_type)?;
- let mut comments = parsed_module.get_comments();
- comments
- .sort_by_key(|comment| parsed_module.get_location(&comment.span).line);
-
+ let comments = parsed_module.get_comments();
let blocks_regex = Regex::new(r"```([^\n]*)\n([\S\s]*?)```")?;
let lines_regex = Regex::new(r"(?:\* ?)(?:\# ?)?(.*)")?;
@@ -442,7 +439,7 @@ fn extract_files_from_source_comments(
true
})
.flat_map(|comment| {
- let location = parsed_module.get_location(&comment.span);
+ let location = parsed_module.get_location(comment.span.lo);
extract_files_from_regex_blocks(
&location,
@@ -464,7 +461,7 @@ fn extract_files_from_fenced_blocks(
media_type: &MediaType,
) -> Result<Vec<File>, AnyError> {
let location = Location {
- filename: specifier.to_string(),
+ specifier: specifier.to_string(),
line: 1,
col: 0,
};