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

Side by Side Diff: pkg/front_end/tool/fasta_perf.dart

Issue 2752093002: Allow AstBuilder to report parse errors. (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// An entrypoint used to run portions of fasta and measure its performance. 5 /// An entrypoint used to run portions of fasta and measure its performance.
6 library front_end.tool.fasta_perf; 6 library front_end.tool.fasta_perf;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 parser.parseUnit(tokens); 226 parser.parseUnit(tokens);
227 } 227 }
228 228
229 class _EmptyScope extends Scope { 229 class _EmptyScope extends Scope {
230 _EmptyScope() : super({}, null); 230 _EmptyScope() : super({}, null);
231 } 231 }
232 232
233 // Note: AstBuilder doesn't build compilation-units or classes, only method 233 // Note: AstBuilder doesn't build compilation-units or classes, only method
234 // bodies. So this listener is not feature complete. 234 // bodies. So this listener is not feature complete.
235 class _PartialAstBuilder extends AstBuilder { 235 class _PartialAstBuilder extends AstBuilder {
236 _PartialAstBuilder(Uri uri) : super(null, null, null, new _EmptyScope(), uri); 236 _PartialAstBuilder(Uri uri)
237 : super(null, null, null, null, new _EmptyScope(), uri);
237 238
238 // Note: this method converts the body to kernel, so we skip that here. 239 // Note: this method converts the body to kernel, so we skip that here.
239 @override 240 @override
240 finishFunction(formals, asyncModifier, body) {} 241 finishFunction(formals, asyncModifier, body) {}
241 } 242 }
242 243
243 // Invoke the fasta kernel generator for the program starting in [entryUri] 244 // Invoke the fasta kernel generator for the program starting in [entryUri]
244 // TODO(sigmund): update to uyse the frontend api once fasta is beind hit. 245 // TODO(sigmund): update to uyse the frontend api once fasta is beind hit.
245 generateKernel(Uri entryUri, {bool compileSdk: true}) async { 246 generateKernel(Uri entryUri, {bool compileSdk: true}) async {
246 // TODO(sigmund): this is here only to compute the input size, 247 // TODO(sigmund): this is here only to compute the input size,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 /// Report that metric [name] took [time] micro-seconds to process 288 /// Report that metric [name] took [time] micro-seconds to process
288 /// [inputSize] characters. 289 /// [inputSize] characters.
289 void report(String name, int time) { 290 void report(String name, int time) {
290 var sb = new StringBuffer(); 291 var sb = new StringBuffer();
291 var padding = ' ' * (20 - name.length); 292 var padding = ' ' * (20 - name.length);
292 sb.write('$name:$padding $time us, ${time ~/ 1000} ms'); 293 sb.write('$name:$padding $time us, ${time ~/ 1000} ms');
293 var invSpeed = (time * 1000 / inputSize).toStringAsFixed(2); 294 var invSpeed = (time * 1000 / inputSize).toStringAsFixed(2);
294 sb.write(', $invSpeed ns/char'); 295 sb.write(', $invSpeed ns/char');
295 print('$sb'); 296 print('$sb');
296 } 297 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698