| 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/services/lint.dart'; | 10 import 'package:analyzer/src/services/lint.dart'; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 /** | 96 /** |
| 97 * Determines how elements model corresponding to the given [node] differs | 97 * Determines how elements model corresponding to the given [node] differs |
| 98 * from the [element]. | 98 * from the [element]. |
| 99 */ | 99 */ |
| 100 DeclarationMatchKind matches(AstNode node, Element element) { | 100 DeclarationMatchKind matches(AstNode node, Element element) { |
| 101 logger.enter('match $element @ ${element.nameOffset}'); | 101 logger.enter('match $element @ ${element.nameOffset}'); |
| 102 try { | 102 try { |
| 103 _captureEnclosingElements(element); | 103 _captureEnclosingElements(element); |
| 104 _gatherElements(element); | 104 _gatherElements(element); |
| 105 node.accept(this); | 105 node.accept(this); |
| 106 } on _DeclarationMismatchException catch (exception) { | 106 } on _DeclarationMismatchException { |
| 107 return DeclarationMatchKind.MISMATCH; | 107 return DeclarationMatchKind.MISMATCH; |
| 108 } finally { | 108 } finally { |
| 109 logger.exit(); | 109 logger.exit(); |
| 110 } | 110 } |
| 111 // no API changes | 111 // no API changes |
| 112 if (_removedElements.isEmpty && _addedElements.isEmpty) { | 112 if (_removedElements.isEmpty && _addedElements.isEmpty) { |
| 113 return DeclarationMatchKind.MATCH; | 113 return DeclarationMatchKind.MATCH; |
| 114 } | 114 } |
| 115 // simple API change | 115 // simple API change |
| 116 logger.log('_removedElements: $_removedElements'); | 116 logger.log('_removedElements: $_removedElements'); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 _assertNotNull(element); | 340 _assertNotNull(element); |
| 341 _assertSameAnnotations(node, element); | 341 _assertSameAnnotations(node, element); |
| 342 _assertEquals(node.isStatic, element.isStatic); | 342 _assertEquals(node.isStatic, element.isStatic); |
| 343 _assertSameType(node.returnType, element.returnType); | 343 _assertSameType(node.returnType, element.returnType); |
| 344 _assertCompatibleParameters(node.parameters, element.parameters); | 344 _assertCompatibleParameters(node.parameters, element.parameters); |
| 345 _assertBodyModifiers(node.body, element); | 345 _assertBodyModifiers(node.body, element); |
| 346 _removedElements.remove(element); | 346 _removedElements.remove(element); |
| 347 // matches, update the existing element | 347 // matches, update the existing element |
| 348 node.name.staticElement = element; | 348 node.name.staticElement = element; |
| 349 _setLocalElements(element, newElement); | 349 _setLocalElements(element, newElement); |
| 350 } on _DeclarationMismatchException catch (e) { | 350 } on _DeclarationMismatchException { |
| 351 _addedElements.add(newElement); | 351 _addedElements.add(newElement); |
| 352 _removeElement(element); | 352 _removeElement(element); |
| 353 // add new element | 353 // add new element |
| 354 if (newElement is MethodElement) { | 354 if (newElement is MethodElement) { |
| 355 List<MethodElement> methods = _enclosingClass.methods; | 355 List<MethodElement> methods = _enclosingClass.methods; |
| 356 methods.add(newElement); | 356 methods.add(newElement); |
| 357 _enclosingClass.methods = methods; | 357 _enclosingClass.methods = methods; |
| 358 } else { | 358 } else { |
| 359 List<PropertyAccessorElement> accessors = _enclosingClass.accessors; | 359 List<PropertyAccessorElement> accessors = _enclosingClass.accessors; |
| 360 accessors.add(newElement); | 360 accessors.add(newElement); |
| (...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1810 @override | 1810 @override |
| 1811 String toString() => name; | 1811 String toString() => name; |
| 1812 } | 1812 } |
| 1813 | 1813 |
| 1814 class _TokenPair { | 1814 class _TokenPair { |
| 1815 final _TokenDifferenceKind kind; | 1815 final _TokenDifferenceKind kind; |
| 1816 final Token oldToken; | 1816 final Token oldToken; |
| 1817 final Token newToken; | 1817 final Token newToken; |
| 1818 _TokenPair(this.kind, this.oldToken, this.newToken); | 1818 _TokenPair(this.kind, this.oldToken, this.newToken); |
| 1819 } | 1819 } |
| OLD | NEW |