| 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 analyzer.src.generated.incremental_resolver; | 5 library analyzer.src.generated.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/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 oldParent is ConstructorDeclaration && | 1486 oldParent is ConstructorDeclaration && |
| 1487 newParent is ConstructorDeclaration) { | 1487 newParent is ConstructorDeclaration) { |
| 1488 Element oldElement = (oldParent as Declaration).element; | 1488 Element oldElement = (oldParent as Declaration).element; |
| 1489 if (new DeclarationMatcher().matches(newParent, oldElement) == | 1489 if (new DeclarationMatcher().matches(newParent, oldElement) == |
| 1490 DeclarationMatchKind.MATCH) { | 1490 DeclarationMatchKind.MATCH) { |
| 1491 oldNode = oldParent; | 1491 oldNode = oldParent; |
| 1492 newNode = newParent; | 1492 newNode = newParent; |
| 1493 found = true; | 1493 found = true; |
| 1494 } | 1494 } |
| 1495 } | 1495 } |
| 1496 if (oldParent is BlockFunctionBody && | 1496 if (oldParent is FunctionBody || newParent is FunctionBody) { |
| 1497 newParent is BlockFunctionBody) { | 1497 if (oldParent is BlockFunctionBody && |
| 1498 oldNode = oldParent; | 1498 newParent is BlockFunctionBody) { |
| 1499 newNode = newParent; | 1499 oldNode = oldParent; |
| 1500 found = true; | 1500 newNode = newParent; |
| 1501 break; | 1501 found = true; |
| 1502 break; |
| 1503 } |
| 1504 logger.log('Failure: not a block function body.'); |
| 1505 return false; |
| 1502 } | 1506 } |
| 1503 } | 1507 } |
| 1504 if (!found) { | 1508 if (!found) { |
| 1505 logger.log('Failure: no enclosing function body or executable.'); | 1509 logger.log('Failure: no enclosing function body or executable.'); |
| 1506 return false; | 1510 return false; |
| 1507 } | 1511 } |
| 1508 // fail if a comment change outside the bodies | 1512 // fail if a comment change outside the bodies |
| 1509 if (firstPair.kind == _TokenDifferenceKind.COMMENT) { | 1513 if (firstPair.kind == _TokenDifferenceKind.COMMENT) { |
| 1510 if (beginOffsetOld <= oldNode.offset || | 1514 if (beginOffsetOld <= oldNode.offset || |
| 1511 beginOffsetNew <= newNode.offset) { | 1515 beginOffsetNew <= newNode.offset) { |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 @override | 2109 @override |
| 2106 String toString() => name; | 2110 String toString() => name; |
| 2107 } | 2111 } |
| 2108 | 2112 |
| 2109 class _TokenPair { | 2113 class _TokenPair { |
| 2110 final _TokenDifferenceKind kind; | 2114 final _TokenDifferenceKind kind; |
| 2111 final Token oldToken; | 2115 final Token oldToken; |
| 2112 final Token newToken; | 2116 final Token newToken; |
| 2113 _TokenPair(this.kind, this.oldToken, this.newToken); | 2117 _TokenPair(this.kind, this.oldToken, this.newToken); |
| 2114 } | 2118 } |
| OLD | NEW |