| 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 'ast.dart'; | 10 import 'ast.dart'; |
| 11 import 'element.dart'; | 11 import 'element.dart'; |
| 12 import 'engine.dart'; | 12 import 'engine.dart'; |
| 13 import 'error.dart'; | 13 import 'error.dart'; |
| 14 import 'error_verifier.dart'; | 14 import 'error_verifier.dart'; |
| 15 import 'incremental_logger.dart' show logger, LoggingTimer; | 15 import 'incremental_logger.dart' show logger, LoggingTimer; |
| 16 import 'java_engine.dart'; | 16 import 'java_engine.dart'; |
| 17 import 'parser.dart'; | 17 import 'parser.dart'; |
| 18 import 'resolver.dart'; | 18 import 'resolver.dart'; |
| 19 import 'scanner.dart'; | 19 import 'scanner.dart'; |
| 20 import 'source.dart'; | 20 import 'source.dart'; |
| 21 import 'utilities_dart.dart'; | 21 import 'utilities_dart.dart'; |
| 22 | 22 |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * If `true`, an attempt to resolve API-changing modifications is made. |
| 26 */ |
| 27 bool _resolveApiChanges = false; |
| 28 |
| 29 |
| 30 /** |
| 25 * Instances of the class [DeclarationMatcher] determine whether the element | 31 * Instances of the class [DeclarationMatcher] determine whether the element |
| 26 * model defined by a given AST structure matches an existing element model. | 32 * model defined by a given AST structure matches an existing element model. |
| 27 */ | 33 */ |
| 28 class DeclarationMatcher extends RecursiveAstVisitor { | 34 class DeclarationMatcher extends RecursiveAstVisitor { |
| 29 /** | 35 /** |
| 30 * The libary containing the AST nodes being visited. | 36 * The libary containing the AST nodes being visited. |
| 31 */ | 37 */ |
| 32 LibraryElement _enclosingLibrary; | 38 LibraryElement _enclosingLibrary; |
| 33 | 39 |
| 34 /** | 40 /** |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 int _updateEndOld; | 955 int _updateEndOld; |
| 950 int _updateEndNew; | 956 int _updateEndNew; |
| 951 | 957 |
| 952 List<AnalysisError> _newScanErrors = <AnalysisError>[]; | 958 List<AnalysisError> _newScanErrors = <AnalysisError>[]; |
| 953 List<AnalysisError> _newParseErrors = <AnalysisError>[]; | 959 List<AnalysisError> _newParseErrors = <AnalysisError>[]; |
| 954 List<AnalysisError> _newResolveErrors = <AnalysisError>[]; | 960 List<AnalysisError> _newResolveErrors = <AnalysisError>[]; |
| 955 List<AnalysisError> _newVerifyErrors = <AnalysisError>[]; | 961 List<AnalysisError> _newVerifyErrors = <AnalysisError>[]; |
| 956 List<AnalysisError> _newHints = <AnalysisError>[]; | 962 List<AnalysisError> _newHints = <AnalysisError>[]; |
| 957 | 963 |
| 958 PoorMansIncrementalResolver(this._typeProvider, this._unitSource, | 964 PoorMansIncrementalResolver(this._typeProvider, this._unitSource, |
| 959 this._librarySource, this._entry); | 965 this._librarySource, this._entry, bool resolveApiChanges) { |
| 966 _resolveApiChanges = resolveApiChanges; |
| 967 } |
| 960 | 968 |
| 961 /** | 969 /** |
| 962 * Attempts to update [oldUnit] to the state corresponding to [newCode]. | 970 * Attempts to update [oldUnit] to the state corresponding to [newCode]. |
| 963 * Returns `true` if success, or `false` otherwise. | 971 * Returns `true` if success, or `false` otherwise. |
| 964 * The [oldUnit] might be damaged. | 972 * The [oldUnit] might be damaged. |
| 965 */ | 973 */ |
| 966 bool resolve(CompilationUnit oldUnit, String newCode) { | 974 bool resolve(CompilationUnit oldUnit, String newCode) { |
| 967 logger.enter('diff/resolve $_unitSource'); | 975 logger.enter('diff/resolve $_unitSource'); |
| 968 logger.log(oldUnit != null ? 'has oldUnit' : 'oldUnit is null'); | 976 logger.log(oldUnit != null ? 'has oldUnit' : 'oldUnit is null'); |
| 969 try { | 977 try { |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 String toString() => name; | 1664 String toString() => name; |
| 1657 } | 1665 } |
| 1658 | 1666 |
| 1659 | 1667 |
| 1660 class _TokenPair { | 1668 class _TokenPair { |
| 1661 final _TokenDifferenceKind kind; | 1669 final _TokenDifferenceKind kind; |
| 1662 final Token oldToken; | 1670 final Token oldToken; |
| 1663 final Token newToken; | 1671 final Token newToken; |
| 1664 _TokenPair(this.kind, this.oldToken, this.newToken); | 1672 _TokenPair(this.kind, this.oldToken, this.newToken); |
| 1665 } | 1673 } |
| OLD | NEW |