| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.incremental_resolver; | 5 library engine.incremental_resolver; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:math' as math; | 8 import 'dart:math' as math; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/constant.dart'; | 10 import 'package:analyzer/src/generated/constant.dart'; |
| (...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 return node; | 992 return node; |
| 993 } | 993 } |
| 994 node = node.parent; | 994 node = node.parent; |
| 995 } | 995 } |
| 996 throw new AnalysisException("Cannot resolve node: no resolvable node"); | 996 throw new AnalysisException("Cannot resolve node: no resolvable node"); |
| 997 } | 997 } |
| 998 | 998 |
| 999 void _generateLints(AstNode node) { | 999 void _generateLints(AstNode node) { |
| 1000 LoggingTimer timer = logger.startTimer(); | 1000 LoggingTimer timer = logger.startTimer(); |
| 1001 try { | 1001 try { |
| 1002 RecordingErrorListener errorListener = new RecordingErrorListener(); | 1002 if (_context.analysisOptions.lint) { |
| 1003 CompilationUnit unit = node.getAncestor((n) => n is CompilationUnit); | 1003 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 1004 LintGenerator lintGenerator = | 1004 CompilationUnit unit = node.getAncestor((n) => n is CompilationUnit); |
| 1005 new LintGenerator(<CompilationUnit>[unit], errorListener); | 1005 LintGenerator lintGenerator = |
| 1006 lintGenerator.generate(); | 1006 new LintGenerator(<CompilationUnit>[unit], errorListener); |
| 1007 _lints = errorListener.getErrorsForSource(_source); | 1007 lintGenerator.generate(); |
| 1008 _lints = errorListener.getErrorsForSource(_source); |
| 1009 } else { |
| 1010 _lints = AnalysisError.NO_ERRORS; |
| 1011 } |
| 1008 } finally { | 1012 } finally { |
| 1009 timer.stop('generate lints'); | 1013 timer.stop('generate lints'); |
| 1010 } | 1014 } |
| 1011 } | 1015 } |
| 1012 | 1016 |
| 1013 /** | 1017 /** |
| 1014 * Return the element defined by [node], or `null` if the node does not | 1018 * Return the element defined by [node], or `null` if the node does not |
| 1015 * define an element. | 1019 * define an element. |
| 1016 */ | 1020 */ |
| 1017 Element _getElement(AstNode node) { | 1021 Element _getElement(AstNode node) { |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1843 @override | 1847 @override |
| 1844 String toString() => name; | 1848 String toString() => name; |
| 1845 } | 1849 } |
| 1846 | 1850 |
| 1847 class _TokenPair { | 1851 class _TokenPair { |
| 1848 final _TokenDifferenceKind kind; | 1852 final _TokenDifferenceKind kind; |
| 1849 final Token oldToken; | 1853 final Token oldToken; |
| 1850 final Token newToken; | 1854 final Token newToken; |
| 1851 _TokenPair(this.kind, this.oldToken, this.newToken); | 1855 _TokenPair(this.kind, this.oldToken, this.newToken); |
| 1852 } | 1856 } |
| OLD | NEW |