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

Unified Diff: pkg/front_end/tool/perf.dart

Issue 2507093003: switch perf tool to use scanner in front_end (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/tool/perf.dart
diff --git a/pkg/front_end/tool/perf.dart b/pkg/front_end/tool/perf.dart
index ec306caf644c524656e26d9c687eef8ef50b2d3c..4d61e9bdfb5f6e5cdce755ef7172cd241d0d97a9 100644
--- a/pkg/front_end/tool/perf.dart
+++ b/pkg/front_end/tool/perf.dart
@@ -9,15 +9,12 @@ import 'dart:async';
import 'dart:io' show exit, stderr;
import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/file_system/file_system.dart' show ResourceUriResolver;
import 'package:analyzer/file_system/physical_file_system.dart'
show PhysicalResourceProvider;
import 'package:analyzer/source/package_map_resolver.dart';
import 'package:analyzer/src/context/builder.dart';
-import 'package:analyzer/src/dart/scanner/reader.dart';
-import 'package:analyzer/src/dart/scanner/scanner.dart';
import 'package:analyzer/src/dart/sdk/sdk.dart' show FolderBasedDartSdk;
import 'package:analyzer/src/generated/parser.dart';
import 'package:analyzer/src/generated/source.dart';
@@ -26,6 +23,10 @@ import 'package:kernel/analyzer/loader.dart';
import 'package:kernel/kernel.dart';
import 'package:package_config/discovery.dart';
+import 'package:front_end/src/scanner/reader.dart';
+import 'package:front_end/src/scanner/scanner.dart';
+import 'package:front_end/src/scanner/token.dart';
+
/// Cumulative total number of chars scanned.
int scanTotalChars = 0;
@@ -205,13 +206,23 @@ Token tokenize(Source source) {
scanTotalChars += contents.length;
// TODO(sigmund): is there a way to scan from a random-access-file without
// first converting to String?
- var scanner = new Scanner(source, new CharSequenceReader(contents),
- AnalysisErrorListener.NULL_LISTENER)..preserveComments = false;
+ var scanner = new _Scanner(contents);
var token = scanner.tokenize();
scanTimer.stop();
return token;
}
+class _Scanner extends Scanner {
+ _Scanner(String contents) : super(new CharSequenceReader(contents)) {
+ preserveComments = false;
+ }
+
+ @override
+ void reportError(errorCode, int offset, List<Object> arguments) {
+ // ignore errors.
+ }
+}
+
/// Report that metric [name] took [time] micro-seconds to process
/// [scanTotalChars] characters.
void report(String name, int time) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698