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_resolution_validator; | 5 library analyzer.src.generated.incremental_resolution_validator; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
9 import 'package:analyzer/dart/element/type.dart'; | 9 import 'package:analyzer/dart/element/type.dart'; |
10 import 'package:analyzer/src/dart/element/element.dart'; | 10 import 'package:analyzer/src/dart/element/element.dart'; |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
842 String locationA = _getElementLocationWithoutUri(a); | 842 String locationA = _getElementLocationWithoutUri(a); |
843 String locationB = _getElementLocationWithoutUri(b); | 843 String locationB = _getElementLocationWithoutUri(b); |
844 if (locationA != locationB) { | 844 if (locationA != locationB) { |
845 int offset = other.offset; | 845 int offset = other.offset; |
846 _fail('[$offset]\nExpected: $b ($locationB)\n Actual: $a ($locationA)'); | 846 _fail('[$offset]\nExpected: $b ($locationB)\n Actual: $a ($locationA)'); |
847 } | 847 } |
848 if (a == null && b == null) { | 848 if (a == null && b == null) { |
849 return; | 849 return; |
850 } | 850 } |
851 if (a.nameOffset != b.nameOffset) { | 851 if (a.nameOffset != b.nameOffset) { |
852 _fail('Expected: ${b.nameOffset}\n Actual: ${a.nameOffset}'); | 852 _fail('nameOffset\nExpected: ${b.nameOffset}\n Actual: ${a.nameOffset}'); |
853 } | |
854 if (a is ElementImpl && b is ElementImpl && a.codeOffset != b.codeOffset) { | |
855 _fail('codeOffset\nExpected: ${b.codeOffset}\n Actual: ${a.codeOffset}'); | |
856 } | |
857 if (a is ElementImpl && b is ElementImpl && a.codeLength != b.codeLength) { | |
Brian Wilkerson
2016/03/04 19:28:03
This code is duplicated.
scheglov
2016/03/04 19:36:31
Done.
| |
858 _fail('codeLength\nExpected: ${b.codeLength}\n Actual: ${a.codeLength}'); | |
853 } | 859 } |
854 if (a is LocalElement && b is LocalElement) { | 860 if (a is LocalElement && b is LocalElement) { |
855 if (a.visibleRange != b.visibleRange) { | 861 if (a.visibleRange != b.visibleRange) { |
856 _fail('Expected: ${b.visibleRange}\nActual: ${a.visibleRange}'); | 862 _fail('Expected: ${b.visibleRange}\nActual: ${a.visibleRange}'); |
857 } | 863 } |
858 } | 864 } |
859 } | 865 } |
860 | 866 |
861 void _verifyType(DartType a, DartType b) { | 867 void _verifyType(DartType a, DartType b) { |
862 if (!validateTypes) { | 868 if (!validateTypes) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
957 * package:project/my_lib.dart -> my_lib.dart | 963 * package:project/my_lib.dart -> my_lib.dart |
958 */ | 964 */ |
959 static String _getShortElementLocationUri(String uri) { | 965 static String _getShortElementLocationUri(String uri) { |
960 int index = uri.lastIndexOf('/'); | 966 int index = uri.lastIndexOf('/'); |
961 if (index == -1) { | 967 if (index == -1) { |
962 return uri; | 968 return uri; |
963 } | 969 } |
964 return uri.substring(index + 1); | 970 return uri.substring(index + 1); |
965 } | 971 } |
966 } | 972 } |
OLD | NEW |