Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: pkg/source_maps/lib/parser.dart

Issue 402843003: Deprecate the source_maps span classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add -dev to version Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/source_maps/lib/builder.dart ('k') | pkg/source_maps/lib/printer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/source_maps/lib/parser.dart
diff --git a/pkg/source_maps/lib/parser.dart b/pkg/source_maps/lib/parser.dart
index 3fd0d1445a659f084f46fb272d28a367a4993e48..c18a1d69bc122e1888862e71416d48dd2b8333d4 100644
--- a/pkg/source_maps/lib/parser.dart
+++ b/pkg/source_maps/lib/parser.dart
@@ -10,6 +10,7 @@ import 'dart:convert';
import 'builder.dart' as builder;
import 'span.dart';
+import 'src/span_wrapper.dart';
import 'src/utils.dart';
import 'src/vlq.dart';
@@ -47,10 +48,21 @@ Mapping parseJson(Map map, {Map<String, Map> otherMaps}) {
/// A mapping parsed out of a source map.
abstract class Mapping {
- Span spanFor(int line, int column, {Map<String, SourceFile> files});
-
- Span spanForLocation(Location loc, {Map<String, SourceFile> files}) {
- return spanFor(loc.line, loc.column, files: files);
+ /// Returns the span associated with [line] and [column].
+ ///
+ /// The values of [files] can be either `source_map` [SourceFile]s or
+ /// `source_span` `SourceFile`s. Using `source_map` [SourceFile]s is
+ /// deprecated and will be unsupported in version 0.10.0.
+ Span spanFor(int line, int column, {Map<String, dynamic> files});
+
+ /// Returns the span associated with [location].
+ ///
+ /// The values of [files] may be either `source_map` [SourceFile]s or
+ /// `source_span` `SourceFile`s. Using `source_map` [SourceFile]s is
+ /// deprecated and will be unsupported in version 0.10.0.
+ Span spanForLocation(location, {Map<String, dynamic> files}) {
+ location = LocationWrapper.wrap(location);
+ return spanFor(location.line, location.column, files: files);
}
}
@@ -112,7 +124,7 @@ class MultiSectionMapping extends Mapping {
return _lineStart.length - 1;
}
- Span spanFor(int line, int column, {Map<String, SourceFile> files}) {
+ Span spanFor(int line, int column, {Map<String, dynamic> files}) {
int index = _indexFor(line, column);
return _maps[index].spanFor(
line - _lineStart[index], column - _columnStart[index], files: files);
@@ -351,7 +363,7 @@ class SingleMapping extends Mapping {
return (index <= 0) ? null : entries[index - 1];
}
- Span spanFor(int line, int column, {Map<String, SourceFile> files}) {
+ Span spanFor(int line, int column, {Map<String, dynamic> files}) {
var entry = _findColumn(line, column, _findLine(line));
if (entry == null || entry.sourceUrlId == null) return null;
var url = urls[entry.sourceUrlId];
@@ -359,7 +371,7 @@ class SingleMapping extends Mapping {
url = '${sourceRoot}${url}';
}
if (files != null && files[url] != null) {
- var file = files[url];
+ var file = SourceFileWrapper.wrap(files[url]);
var start = file.getOffset(entry.sourceLine, entry.sourceColumn);
if (entry.sourceNameId != null) {
var text = names[entry.sourceNameId];
« no previous file with comments | « pkg/source_maps/lib/builder.dart ('k') | pkg/source_maps/lib/printer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698