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

Side by Side Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 1807723002: Timing hooks to profile linters (#24548). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library analyzer.src.task.dart; 5 library analyzer.src.task.dart;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 2795 matching lines...) Expand 10 before | Expand all | Expand 10 after
2806 Source source = getRequiredSource(); 2806 Source source = getRequiredSource();
2807 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); 2807 ErrorReporter errorReporter = new ErrorReporter(errorListener, source);
2808 // 2808 //
2809 // Prepare inputs. 2809 // Prepare inputs.
2810 // 2810 //
2811 CompilationUnit unit = getRequiredInput(RESOLVED_UNIT_INPUT); 2811 CompilationUnit unit = getRequiredInput(RESOLVED_UNIT_INPUT);
2812 2812
2813 // 2813 //
2814 // Generate lints. 2814 // Generate lints.
2815 // 2815 //
2816 List<AstVisitor> visitors = <AstVisitor>[];
2817
2816 List<Linter> linters = getLints(context); 2818 List<Linter> linters = getLints(context);
2817 linters.forEach((l) => l.reporter = errorReporter); 2819 for (Linter linter in linters) {
2818 Iterable<AstVisitor> visitors = linters.map((l) => l.getVisitor()).toList(); 2820 AstVisitor visitor = linter.getVisitor();
2819 unit.accept(new DelegatingAstVisitor(visitors.where((v) => v != null))); 2821 if (visitor != null) {
2822 linter.reporter = errorReporter;
2823 visitors
2824 .add(new TimedAstVisitor(visitor, lintRegistry.getTimer(linter)));
2825 }
2826 }
2827
2828 DelegatingAstVisitor dv = new DelegatingAstVisitor(visitors);
2829 unit.accept(dv);
2820 2830
2821 // 2831 //
2822 // Record outputs. 2832 // Record outputs.
2823 // 2833 //
2824 outputs[LINTS] = errorListener.errors; 2834 outputs[LINTS] = errorListener.errors;
2825 } 2835 }
2826 2836
2827 /** 2837 /**
2828 * Return a map from the names of the inputs of this kind of task to the task 2838 * Return a map from the names of the inputs of this kind of task to the task
2829 * input descriptors describing those inputs for a task with the 2839 * input descriptors describing those inputs for a task with the
(...skipping 2507 matching lines...) Expand 10 before | Expand all | Expand 10 after
5337 5347
5338 @override 5348 @override
5339 bool moveNext() { 5349 bool moveNext() {
5340 if (_newSources.isEmpty) { 5350 if (_newSources.isEmpty) {
5341 return false; 5351 return false;
5342 } 5352 }
5343 currentTarget = _newSources.removeLast(); 5353 currentTarget = _newSources.removeLast();
5344 return true; 5354 return true;
5345 } 5355 }
5346 } 5356 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698