Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: pkg/analyzer/lib/src/generated/incremental_resolution_validator.dart

Issue 1696193003: Fix cache corruption in incremental resolver (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10 matching lines...) Expand all
21 actual.accept(validator); 21 actual.accept(validator);
22 } 22 }
23 23
24 /** 24 /**
25 * This exception is thrown when a mismatch between actual and expected AST 25 * This exception is thrown when a mismatch between actual and expected AST
26 * or resolution is found. 26 * or resolution is found.
27 */ 27 */
28 class IncrementalResolutionMismatch { 28 class IncrementalResolutionMismatch {
29 final String message; 29 final String message;
30 IncrementalResolutionMismatch(this.message); 30 IncrementalResolutionMismatch(this.message);
31
32 @override
33 String toString() => "IncrementalResolutionMismatch: $message";
31 } 34 }
32 35
33 class _SameResolutionValidator implements AstVisitor { 36 class _SameResolutionValidator implements AstVisitor {
34 final bool validateTypes; 37 final bool validateTypes;
35 AstNode other; 38 AstNode other; // expected
Brian Wilkerson 2016/02/16 15:10:48 nit: the comment should be a dartdoc
skybrian 2016/02/17 01:23:41 Done. (Actually the variable should be renamed, bu
36 39
37 _SameResolutionValidator(this.validateTypes, this.other); 40 _SameResolutionValidator(this.validateTypes, this.other);
38 41
39 @override 42 @override
40 visitAdjacentStrings(AdjacentStrings node) {} 43 visitAdjacentStrings(AdjacentStrings node) {}
41 44
42 @override 45 @override
43 visitAnnotation(Annotation node) { 46 visitAnnotation(Annotation node) {
44 Annotation other = this.other; 47 Annotation other = this.other;
45 _visitNode(node.name, other.name); 48 _visitNode(node.name, other.name);
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 883
881 void _visitExpression(Expression a, Expression b) { 884 void _visitExpression(Expression a, Expression b) {
882 // print('[${a.offset}] |$a| vs. [${b.offset}] |$b|'); 885 // print('[${a.offset}] |$a| vs. [${b.offset}] |$b|');
883 _verifyType(a.staticType, b.staticType); 886 _verifyType(a.staticType, b.staticType);
884 _verifyType(a.propagatedType, b.propagatedType); 887 _verifyType(a.propagatedType, b.propagatedType);
885 _verifyElement(a.staticParameterElement, b.staticParameterElement); 888 _verifyElement(a.staticParameterElement, b.staticParameterElement);
886 _verifyElement(a.propagatedParameterElement, b.propagatedParameterElement); 889 _verifyElement(a.propagatedParameterElement, b.propagatedParameterElement);
887 _assertNode(a, b); 890 _assertNode(a, b);
888 } 891 }
889 892
890 void _visitList(NodeList nodeList, NodeList otherList) { 893 void _visitList(NodeList nodeList, NodeList expected) {
891 int length = nodeList.length; 894 int length = nodeList.length;
892 _expectLength(otherList, length); 895 _expectLength(nodeList, expected.length);
893 for (int i = 0; i < length; i++) { 896 for (int i = 0; i < length; i++) {
894 _visitNode(nodeList[i], otherList[i]); 897 _visitNode(nodeList[i], expected[i]);
895 } 898 }
896 } 899 }
897 900
898 void _visitNode(AstNode node, AstNode other) { 901 void _visitNode(AstNode node, AstNode other) {
899 if (node == null) { 902 if (node == null) {
900 _expectIsNull(other); 903 _expectIsNull(other);
901 } else { 904 } else {
902 this.other = other; 905 this.other = other;
903 _assertNode(node, other); 906 _assertNode(node, other);
904 node.accept(this); 907 node.accept(this);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 * package:project/my_lib.dart -> my_lib.dart 955 * package:project/my_lib.dart -> my_lib.dart
953 */ 956 */
954 static String _getShortElementLocationUri(String uri) { 957 static String _getShortElementLocationUri(String uri) {
955 int index = uri.lastIndexOf('/'); 958 int index = uri.lastIndexOf('/');
956 if (index == -1) { 959 if (index == -1) {
957 return uri; 960 return uri;
958 } 961 }
959 return uri.substring(index + 1); 962 return uri.substring(index + 1);
960 } 963 }
961 } 964 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698