| OLD | NEW |
| 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 3231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3242 // | 3242 // |
| 3243 // Prepare collectors. | 3243 // Prepare collectors. |
| 3244 // | 3244 // |
| 3245 RecordingErrorListener errorListener = new RecordingErrorListener(); | 3245 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 3246 Source source = getRequiredSource(); | 3246 Source source = getRequiredSource(); |
| 3247 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); | 3247 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); |
| 3248 // | 3248 // |
| 3249 // Prepare inputs. | 3249 // Prepare inputs. |
| 3250 // | 3250 // |
| 3251 CompilationUnit unit = getRequiredInput(RESOLVED_UNIT_INPUT); | 3251 CompilationUnit unit = getRequiredInput(RESOLVED_UNIT_INPUT); |
| 3252 | |
| 3253 // | 3252 // |
| 3254 // Generate lints. | 3253 // Generate lints. |
| 3255 // | 3254 // |
| 3256 List<AstVisitor> visitors = <AstVisitor>[]; | 3255 List<AstVisitor> visitors = <AstVisitor>[]; |
| 3257 | |
| 3258 bool timeVisits = analysisOptions.enableTiming; | 3256 bool timeVisits = analysisOptions.enableTiming; |
| 3259 List<Linter> linters = getLints(context); | 3257 List<Linter> linters = getLints(context); |
| 3260 int length = linters.length; | 3258 int length = linters.length; |
| 3261 for (int i = 0; i < length; i++) { | 3259 for (int i = 0; i < length; i++) { |
| 3262 Linter linter = linters[i]; | 3260 Linter linter = linters[i]; |
| 3263 AstVisitor visitor = linter.getVisitor(); | 3261 AstVisitor visitor = linter.getVisitor(); |
| 3264 if (visitor != null) { | 3262 if (visitor != null) { |
| 3265 linter.reporter = errorReporter; | 3263 linter.reporter = errorReporter; |
| 3266 if (timeVisits) { | 3264 if (timeVisits) { |
| 3267 visitor = new TimedAstVisitor(visitor, lintRegistry.getTimer(linter)); | 3265 visitor = new TimedAstVisitor(visitor, lintRegistry.getTimer(linter)); |
| 3268 } | 3266 } |
| 3269 visitors.add(visitor); | 3267 visitors.add(visitor); |
| 3270 } | 3268 } |
| 3271 } | 3269 } |
| 3272 | 3270 AstVisitor visitor = new ExceptionHandlingDelegatingAstVisitor( |
| 3273 DelegatingAstVisitor dv = new DelegatingAstVisitor(visitors); | 3271 visitors, ExceptionHandlingDelegatingAstVisitor.logException); |
| 3274 unit.accept(dv); | 3272 unit.accept(visitor); |
| 3275 | |
| 3276 // | 3273 // |
| 3277 // Record outputs. | 3274 // Record outputs. |
| 3278 // | 3275 // |
| 3279 outputs[LINTS] = errorListener.errors; | 3276 outputs[LINTS] = errorListener.errors; |
| 3280 } | 3277 } |
| 3281 | 3278 |
| 3282 /** | 3279 /** |
| 3283 * Return a map from the names of the inputs of this kind of task to the task | 3280 * Return a map from the names of the inputs of this kind of task to the task |
| 3284 * input descriptors describing those inputs for a task with the | 3281 * input descriptors describing those inputs for a task with the |
| 3285 * given [target]. | 3282 * given [target]. |
| (...skipping 3158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6444 | 6441 |
| 6445 @override | 6442 @override |
| 6446 bool moveNext() { | 6443 bool moveNext() { |
| 6447 if (_newSources.isEmpty) { | 6444 if (_newSources.isEmpty) { |
| 6448 return false; | 6445 return false; |
| 6449 } | 6446 } |
| 6450 currentTarget = _newSources.removeLast(); | 6447 currentTarget = _newSources.removeLast(); |
| 6451 return true; | 6448 return true; |
| 6452 } | 6449 } |
| 6453 } | 6450 } |
| OLD | NEW |