Chromium Code Reviews| 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/context/cache.dart' | 10 import 'package:analyzer/src/context/cache.dart' |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 843 * The context the compilation unit being resolved in. | 843 * The context the compilation unit being resolved in. |
| 844 */ | 844 */ |
| 845 AnalysisContext _context; | 845 AnalysisContext _context; |
| 846 | 846 |
| 847 /** | 847 /** |
| 848 * The object used to access the types from the core library. | 848 * The object used to access the types from the core library. |
| 849 */ | 849 */ |
| 850 TypeProvider _typeProvider; | 850 TypeProvider _typeProvider; |
| 851 | 851 |
| 852 /** | 852 /** |
| 853 * The object used to access the types from the core library. | |
|
Paul Berry
2015/09/05 03:25:39
Copy-pasted comment.
Leaf
2015/09/15 23:01:12
Done.
| |
| 854 */ | |
| 855 TypeSystem _typeSystem; | |
| 856 | |
| 857 /** | |
| 853 * The element for the library containing the compilation unit being resolved. | 858 * The element for the library containing the compilation unit being resolved. |
| 854 */ | 859 */ |
| 855 LibraryElementImpl _definingLibrary; | 860 LibraryElementImpl _definingLibrary; |
| 856 | 861 |
| 857 /** | 862 /** |
| 858 * The [DartEntry] corresponding to the source being resolved. | 863 * The [DartEntry] corresponding to the source being resolved. |
| 859 */ | 864 */ |
| 860 DartEntry oldEntry; | 865 DartEntry oldEntry; |
| 861 | 866 |
| 862 /** | 867 /** |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 913 this._definingUnit, | 918 this._definingUnit, |
| 914 this._updateOffset, | 919 this._updateOffset, |
| 915 this._updateEndOld, | 920 this._updateEndOld, |
| 916 this._updateEndNew) { | 921 this._updateEndNew) { |
| 917 _updateDelta = _updateEndNew - _updateEndOld; | 922 _updateDelta = _updateEndNew - _updateEndOld; |
| 918 _definingLibrary = _definingUnit.library; | 923 _definingLibrary = _definingUnit.library; |
| 919 _librarySource = _definingLibrary.source; | 924 _librarySource = _definingLibrary.source; |
| 920 _source = _definingUnit.source; | 925 _source = _definingUnit.source; |
| 921 _context = _definingUnit.context; | 926 _context = _definingUnit.context; |
| 922 _typeProvider = _context.typeProvider; | 927 _typeProvider = _context.typeProvider; |
| 928 _typeSystem = _context.typeSystem; | |
| 923 } | 929 } |
| 924 | 930 |
| 925 /** | 931 /** |
| 926 * Resolve [node], reporting any errors or warnings to the given listener. | 932 * Resolve [node], reporting any errors or warnings to the given listener. |
| 927 * | 933 * |
| 928 * [node] - the root of the AST structure to be resolved. | 934 * [node] - the root of the AST structure to be resolved. |
| 929 * | 935 * |
| 930 * Returns `true` if resolution was successful. | 936 * Returns `true` if resolution was successful. |
| 931 */ | 937 */ |
| 932 bool resolve(AstNode node) { | 938 bool resolve(AstNode node) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1028 CompilationUnit unit = node.getAncestor((n) => n is CompilationUnit); | 1034 CompilationUnit unit = node.getAncestor((n) => n is CompilationUnit); |
| 1029 ConstantValueComputer computer = new ConstantValueComputer( | 1035 ConstantValueComputer computer = new ConstantValueComputer( |
| 1030 _context, _typeProvider, _context.declaredVariables); | 1036 _context, _typeProvider, _context.declaredVariables); |
| 1031 computer.add(unit, _source, _librarySource); | 1037 computer.add(unit, _source, _librarySource); |
| 1032 computer.computeValues(); | 1038 computer.computeValues(); |
| 1033 } | 1039 } |
| 1034 // validate | 1040 // validate |
| 1035 { | 1041 { |
| 1036 ErrorReporter errorReporter = new ErrorReporter(errorListener, _source); | 1042 ErrorReporter errorReporter = new ErrorReporter(errorListener, _source); |
| 1037 ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, | 1043 ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, |
| 1038 _definingLibrary, _typeProvider, _context.declaredVariables); | 1044 _definingLibrary, _typeProvider, _typeSystem, _context.declaredVariables); |
| 1039 node.accept(constantVerifier); | 1045 node.accept(constantVerifier); |
| 1040 } | 1046 } |
| 1041 } | 1047 } |
| 1042 | 1048 |
| 1043 /** | 1049 /** |
| 1044 * Starting at [node], find the smallest AST node that can be resolved | 1050 * Starting at [node], find the smallest AST node that can be resolved |
| 1045 * independently of any other nodes. Return the node that was found. | 1051 * independently of any other nodes. Return the node that was found. |
| 1046 * | 1052 * |
| 1047 * [node] - the node at which the search is to begin | 1053 * [node] - the node at which the search is to begin |
| 1048 * | 1054 * |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1242 | 1248 |
| 1243 void _verify(AstNode node) { | 1249 void _verify(AstNode node) { |
| 1244 LoggingTimer timer = logger.startTimer(); | 1250 LoggingTimer timer = logger.startTimer(); |
| 1245 try { | 1251 try { |
| 1246 RecordingErrorListener errorListener = new RecordingErrorListener(); | 1252 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 1247 ErrorReporter errorReporter = new ErrorReporter(errorListener, _source); | 1253 ErrorReporter errorReporter = new ErrorReporter(errorListener, _source); |
| 1248 ErrorVerifier errorVerifier = new ErrorVerifier( | 1254 ErrorVerifier errorVerifier = new ErrorVerifier( |
| 1249 errorReporter, | 1255 errorReporter, |
| 1250 _definingLibrary, | 1256 _definingLibrary, |
| 1251 _typeProvider, | 1257 _typeProvider, |
| 1258 _typeSystem, | |
| 1252 new InheritanceManager(_definingLibrary), | 1259 new InheritanceManager(_definingLibrary), |
| 1253 _context.analysisOptions.enableSuperMixins); | 1260 _context.analysisOptions.enableSuperMixins); |
| 1254 if (_resolutionContext.enclosingClassDeclaration != null) { | 1261 if (_resolutionContext.enclosingClassDeclaration != null) { |
| 1255 errorVerifier.visitClassDeclarationIncrementally( | 1262 errorVerifier.visitClassDeclarationIncrementally( |
| 1256 _resolutionContext.enclosingClassDeclaration); | 1263 _resolutionContext.enclosingClassDeclaration); |
| 1257 } | 1264 } |
| 1258 node.accept(errorVerifier); | 1265 node.accept(errorVerifier); |
| 1259 _verifyErrors = errorListener.getErrorsForSource(_source); | 1266 _verifyErrors = errorListener.getErrorsForSource(_source); |
| 1260 } finally { | 1267 } finally { |
| 1261 timer.stop('verify'); | 1268 timer.stop('verify'); |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2024 @override | 2031 @override |
| 2025 String toString() => name; | 2032 String toString() => name; |
| 2026 } | 2033 } |
| 2027 | 2034 |
| 2028 class _TokenPair { | 2035 class _TokenPair { |
| 2029 final _TokenDifferenceKind kind; | 2036 final _TokenDifferenceKind kind; |
| 2030 final Token oldToken; | 2037 final Token oldToken; |
| 2031 final Token newToken; | 2038 final Token newToken; |
| 2032 _TokenPair(this.kind, this.oldToken, this.newToken); | 2039 _TokenPair(this.kind, this.oldToken, this.newToken); |
| 2033 } | 2040 } |
| OLD | NEW |