| 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 linter.src.linter; | 5 library linter.src.linter; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:analyzer/analyzer.dart'; | 9 import 'package:analyzer/analyzer.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart' | 10 import 'package:analyzer/src/generated/engine.dart' |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // processing gets pushed down, this hack can go away.) | 91 // processing gets pushed down, this hack can go away.) |
| 92 if (rule.reporter == null && sourceUrl != null) { | 92 if (rule.reporter == null && sourceUrl != null) { |
| 93 var source = createSource(sourceUrl); | 93 var source = createSource(sourceUrl); |
| 94 rule.reporter = new ErrorReporter(this, source); | 94 rule.reporter = new ErrorReporter(this, source); |
| 95 } | 95 } |
| 96 try { | 96 try { |
| 97 spec.accept(visitor); | 97 spec.accept(visitor); |
| 98 } on Exception catch (e) { | 98 } on Exception catch (e) { |
| 99 reporter.exception(new LinterException(e.toString())); | 99 reporter.exception(new LinterException(e.toString())); |
| 100 } | 100 } |
| 101 if (rule._locationInfo != null && !rule._locationInfo.isEmpty) { | 101 if (rule._locationInfo != null && rule._locationInfo.isNotEmpty) { |
| 102 results.addAll(rule._locationInfo); | 102 results.addAll(rule._locationInfo); |
| 103 rule._locationInfo.clear(); | 103 rule._locationInfo.clear(); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 return results; | 109 return results; |
| 110 } | 110 } |
| 111 | 111 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 // processing gets pushed down, this hack can go away.) | 392 // processing gets pushed down, this hack can go away.) |
| 393 if (rule.reporter == null && sourceUrl != null) { | 393 if (rule.reporter == null && sourceUrl != null) { |
| 394 var source = createSource(sourceUrl); | 394 var source = createSource(sourceUrl); |
| 395 rule.reporter = new ErrorReporter(this, source); | 395 rule.reporter = new ErrorReporter(this, source); |
| 396 } | 396 } |
| 397 try { | 397 try { |
| 398 spec.accept(visitor); | 398 spec.accept(visitor); |
| 399 } on Exception catch (e) { | 399 } on Exception catch (e) { |
| 400 reporter.exception(new LinterException(e.toString())); | 400 reporter.exception(new LinterException(e.toString())); |
| 401 } | 401 } |
| 402 if (rule._locationInfo != null && !rule._locationInfo.isEmpty) { | 402 if (rule._locationInfo != null && rule._locationInfo.isNotEmpty) { |
| 403 results.addAll(rule._locationInfo); | 403 results.addAll(rule._locationInfo); |
| 404 rule._locationInfo.clear(); | 404 rule._locationInfo.clear(); |
| 405 } | 405 } |
| 406 } | 406 } |
| 407 } | 407 } |
| 408 } | 408 } |
| 409 | 409 |
| 410 return results; | 410 return results; |
| 411 } | 411 } |
| 412 | 412 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 428 } | 428 } |
| 429 | 429 |
| 430 class _LintCode extends LintCode { | 430 class _LintCode extends LintCode { |
| 431 static final registry = <String, LintCode>{}; | 431 static final registry = <String, LintCode>{}; |
| 432 | 432 |
| 433 factory _LintCode(String name, String message) => registry.putIfAbsent( | 433 factory _LintCode(String name, String message) => registry.putIfAbsent( |
| 434 name + message, () => new _LintCode._(name, message)); | 434 name + message, () => new _LintCode._(name, message)); |
| 435 | 435 |
| 436 _LintCode._(String name, String message) : super(name, message); | 436 _LintCode._(String name, String message) : super(name, message); |
| 437 } | 437 } |
| OLD | NEW |