| Index: pkg/compiler/lib/src/io/source_map_builder.dart
|
| diff --git a/pkg/compiler/lib/src/io/source_map_builder.dart b/pkg/compiler/lib/src/io/source_map_builder.dart
|
| index d1b63dadc349a0dbbcec1dc1d22fd435ba4a2c03..de2abfb052e46820342f2551b3788d8b2f0ce9ac 100644
|
| --- a/pkg/compiler/lib/src/io/source_map_builder.dart
|
| +++ b/pkg/compiler/lib/src/io/source_map_builder.dart
|
| @@ -4,10 +4,11 @@
|
|
|
| library dart2js.source_map_builder;
|
|
|
| +import 'package:kernel/ast.dart' show Location;
|
| import '../../compiler_new.dart' show OutputSink, OutputType;
|
| import '../util/uri_extras.dart' show relativize;
|
| import '../util/util.dart';
|
| -import 'line_column_provider.dart';
|
| +import 'location_provider.dart';
|
| import 'code_output.dart' show SourceLocationsProvider, SourceLocations;
|
| import 'source_information.dart' show SourceLocation;
|
|
|
| @@ -20,11 +21,11 @@ class SourceMapBuilder {
|
| /// The URI of the target language file.
|
| final Uri targetFileUri;
|
|
|
| - final LineColumnProvider lineColumnProvider;
|
| + final LocationProvider locationProvider;
|
| final List<SourceMapEntry> entries = new List<SourceMapEntry>();
|
|
|
| SourceMapBuilder(this.version, this.sourceMapUri, this.targetFileUri,
|
| - this.lineColumnProvider);
|
| + this.locationProvider);
|
|
|
| void addMapping(int targetOffset, SourceLocation sourceLocation) {
|
| entries.add(new SourceMapEntry(sourceLocation, targetOffset));
|
| @@ -49,9 +50,10 @@ class SourceMapBuilder {
|
| Map<Uri, LineColumnMap<SourceMapEntry>> sourceLocationMap =
|
| <Uri, LineColumnMap<SourceMapEntry>>{};
|
| entries.forEach((SourceMapEntry sourceMapEntry) {
|
| - int line = lineColumnProvider.getLine(sourceMapEntry.targetOffset);
|
| - int column =
|
| - lineColumnProvider.getColumn(line, sourceMapEntry.targetOffset);
|
| + Location kernelLocation =
|
| + locationProvider.getLocation(sourceMapEntry.targetOffset);
|
| + int line = kernelLocation.line - 1;
|
| + int column = kernelLocation.column - 1;
|
| lineColumnMap.add(line, column, sourceMapEntry);
|
|
|
| SourceLocation location = sourceMapEntry.sourceLocation;
|
| @@ -182,13 +184,13 @@ class SourceMapBuilder {
|
| }
|
|
|
| /// Generates source map files for all [SourceLocations] in
|
| - /// [sourceLocationsProvider] for the .js code in [lineColumnProvider]
|
| + /// [sourceLocationsProvider] for the .js code in [locationProvider]
|
| /// [sourceMapUri] is used to relativizes the URIs of the referenced source
|
| /// files and the target [fileUri]. [name] and [outputProvider] are used to
|
| /// create the [OutputSink] for the source map text.
|
| static void outputSourceMap(
|
| SourceLocationsProvider sourceLocationsProvider,
|
| - LineColumnProvider lineColumnProvider,
|
| + LocationProvider locationProvider,
|
| String name,
|
| Uri sourceMapUri,
|
| Uri fileUri,
|
| @@ -200,7 +202,7 @@ class SourceMapBuilder {
|
| sourceLocationsProvider.sourceLocations
|
| .forEach((SourceLocations sourceLocations) {
|
| SourceMapBuilder sourceMapBuilder = new SourceMapBuilder(
|
| - sourceLocations.name, sourceMapUri, fileUri, lineColumnProvider);
|
| + sourceLocations.name, sourceMapUri, fileUri, locationProvider);
|
| sourceLocations.forEachSourceLocation(sourceMapBuilder.addMapping);
|
| String sourceMap = sourceMapBuilder.build();
|
| String extension = 'js.map';
|
|
|