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

Unified Diff: pkg/compiler/lib/src/io/source_information.dart

Issue 1081313003: Improve precision of JS printer callbacks (2nd try) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 5 years, 8 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/compiler/lib/src/io/code_output.dart ('k') | pkg/compiler/lib/src/js/js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/io/source_information.dart
diff --git a/pkg/compiler/lib/src/io/source_information.dart b/pkg/compiler/lib/src/io/source_information.dart
index 6ee34e6f7645a9fb25854d633b08043fc9102476..28e2191318bac9f9322014456828a9186dca963b 100644
--- a/pkg/compiler/lib/src/io/source_information.dart
+++ b/pkg/compiler/lib/src/io/source_information.dart
@@ -9,15 +9,18 @@ import '../elements/elements.dart' show AstElement;
import '../scanner/scannerlib.dart' show Token;
import '../tree/tree.dart' show Node;
import '../js/js.dart' show JavaScriptNodeSourceInformation;
-import 'code_output.dart';
import 'source_file.dart';
/// Interface for passing source information, for instance for use in source
/// maps, through the backend.
abstract class SourceInformation extends JavaScriptNodeSourceInformation {
SourceSpan get sourceSpan;
- void beginMapping(CodeOutput output);
- void endMapping(CodeOutput output);
+
+ /// The source location associated with the start of the JS node.
+ SourceLocation get startPosition;
+
+ /// The source location associated with the end of the JS node.
+ SourceLocation get endPosition;
}
/// Source information that contains start source position and optionally an
@@ -35,18 +38,6 @@ class StartEndSourceInformation implements SourceInformation {
return new SourceSpan(uri, begin, end);
}
- void beginMapping(CodeBuffer output) {
- output.beginMappedRange();
- output.setSourceLocation(startPosition);
- }
-
- void endMapping(CodeBuffer output) {
- if (endPosition != null) {
- output.setSourceLocation(endPosition);
- }
- output.endMappedRange();
- }
-
int get hashCode {
return (startPosition.hashCode * 17 +
endPosition.hashCode * 19)
@@ -111,15 +102,8 @@ class PositionSourceInformation implements SourceInformation {
PositionSourceInformation(this.sourcePosition);
- @override
- void beginMapping(CodeOutput output) {
- output.setSourceLocation(sourcePosition);
- }
-
- @override
- void endMapping(CodeOutput output) {
- // Do nothing.
- }
+ SourceLocation get startPosition => sourcePosition;
+ SourceLocation get endPosition => null;
SourceSpan get sourceSpan {
Uri uri = sourcePosition.sourceUri;
« no previous file with comments | « pkg/compiler/lib/src/io/code_output.dart ('k') | pkg/compiler/lib/src/js/js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698