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

Unified Diff: pkg/front_end/lib/src/fasta/source/source_loader.dart

Issue 2704753002: Implement line and column numbers. (Closed)
Patch Set: Change message. Created 3 years, 10 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
Index: pkg/front_end/lib/src/fasta/source/source_loader.dart
diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart
index c2a6b5ed7f927a2b6baf2a9f0f4be8acf7964f4c..d1d3da25def111eb2bd7b0cdbbeafc0e34921d35 100644
--- a/pkg/front_end/lib/src/fasta/source/source_loader.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart
@@ -15,6 +15,7 @@ import 'package:front_end/src/fasta/scanner/io.dart' show
import 'package:front_end/src/fasta/scanner.dart' show
ErrorToken,
+ ScannerResult,
Token,
scan;
@@ -34,6 +35,9 @@ import '../errors.dart' show
InputError,
inputError;
+import '../messages.dart' show
+ warning;
+
import '../export.dart' show
Export;
@@ -86,13 +90,16 @@ class SourceLoader<L> extends Loader<L> {
try {
List<int> bytes = await readBytesFromFile(uri);
byteCount += bytes.length - 1;
- Token token = scan(bytes).tokens;
+ ScannerResult result = scan(bytes);
+ Token token = result.tokens;
+ if (!suppressLexicalErrors) {
+ target.addLineStarts(library.fileUri, result.lineStarts);
+ }
while (token is ErrorToken) {
if (!suppressLexicalErrors) {
ErrorToken error = token;
- String message = new InputError(
- uri, token.charOffset, error.assertionMessage).format();
- print(message);
+ print(new InputError(uri, token.charOffset, error.assertionMessage)
+ .format());
}
token = token.next;
}
@@ -128,6 +135,7 @@ class SourceLoader<L> extends Loader<L> {
for (SourceLibraryBuilder part in library.parts) {
Token tokens = await tokenize(part);
if (tokens != null) {
+ listener.uri = part.fileUri;
parser.parseUnit(tokens);
}
}
@@ -335,8 +343,8 @@ class SourceLoader<L> extends Loader<L> {
reported.add(cls);
}
}
- print("${cls.name} is a supertype of itself via "
- "${involved.map((c) => c.name).join(' ')}");
+ warning(cls.fileUri, cls.charOffset, "'${cls.name}' is a supertype of "
+ "itself via '${involved.map((c) => c.name).join(' ')}'.");
}
});
ticker.logMs("Found cycles");
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/source_library_builder.dart ('k') | pkg/front_end/lib/src/fasta/source/stack_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698