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

Unified Diff: sdk/lib/_internal/compiler/implementation/source_map_builder.dart

Issue 85813002: Revert "Revert "Build new IR for functions returning a constant."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: feedback by kasper Created 7 years, 1 month 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
Index: sdk/lib/_internal/compiler/implementation/source_map_builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/source_map_builder.dart b/sdk/lib/_internal/compiler/implementation/source_map_builder.dart
index 1665d222fd334181ac89e6b452c306b472c8a015..a4d2e4baac1fa28aeaf1f29b3be1d86507056364 100644
--- a/sdk/lib/_internal/compiler/implementation/source_map_builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/source_map_builder.dart
@@ -173,28 +173,50 @@ class SourceMapEntry {
SourceMapEntry(this.sourceLocation, this.targetOffset);
}
-class SourceFileLocation {
+abstract class SourceFileLocation {
SourceFile sourceFile;
- Token token;
- int line;
- SourceFileLocation(this.sourceFile, this.token) {
+ SourceFileLocation(this.sourceFile) {
assert(isValid());
}
+ int line;
+
+ int get offset;
+
String getSourceUrl() => sourceFile.filename;
int getLine() {
- if (line == null) line = sourceFile.getLine(token.charOffset);
+ if (line == null) line = sourceFile.getLine(offset);
return line;
}
- int getColumn() => sourceFile.getColumn(getLine(), token.charOffset);
+ int getColumn() => sourceFile.getColumn(getLine(), offset);
+
+ String getSourceName();
+
+ bool isValid() => offset < sourceFile.length;
+}
+
+class TokenSourceFileLocation extends SourceFileLocation {
+ final Token token;
+
+ TokenSourceFileLocation(SourceFile sourceFile, this.token)
+ : super(sourceFile);
+
+ int get offset => token.charOffset;
String getSourceName() {
if (token.isIdentifier()) return token.value;
return null;
}
+}
+
+class OffsetSourceFileLocation extends SourceFileLocation {
+ final int offset;
+ final String sourceName;
+ OffsetSourceFileLocation(SourceFile sourceFile, this.offset,
+ [this.sourceName]) : super(sourceFile);
- bool isValid() => token.charOffset < sourceFile.length;
+ String getSourceName() => sourceName;
}

Powered by Google App Engine
This is Rietveld 408576698