OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analysis_server.src.status.validator; | 5 library analysis_server.src.status.validator; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
11 import 'package:analyzer/dart/element/element.dart'; | 11 import 'package:analyzer/dart/element/element.dart'; |
12 import 'package:analyzer/dart/element/type.dart'; | 12 import 'package:analyzer/dart/element/type.dart'; |
| 13 import 'package:analyzer/error/error.dart'; |
13 import 'package:analyzer/src/context/cache.dart'; | 14 import 'package:analyzer/src/context/cache.dart'; |
14 import 'package:analyzer/src/context/context.dart'; | 15 import 'package:analyzer/src/context/context.dart'; |
15 import 'package:analyzer/src/dart/ast/utilities.dart'; | 16 import 'package:analyzer/src/dart/ast/utilities.dart'; |
16 import 'package:analyzer/src/dart/element/element.dart'; | 17 import 'package:analyzer/src/dart/element/element.dart'; |
17 import 'package:analyzer/src/generated/engine.dart' | 18 import 'package:analyzer/src/generated/engine.dart' |
18 show AnalysisEngine, AnalysisResult, CacheState, ChangeSet; | 19 show AnalysisEngine, AnalysisResult, CacheState, ChangeSet; |
19 import 'package:analyzer/src/generated/error.dart'; | |
20 import 'package:analyzer/src/generated/resolver.dart'; | 20 import 'package:analyzer/src/generated/resolver.dart'; |
21 import 'package:analyzer/src/generated/source.dart'; | 21 import 'package:analyzer/src/generated/source.dart'; |
22 import 'package:analyzer/src/generated/utilities_collection.dart'; | 22 import 'package:analyzer/src/generated/utilities_collection.dart'; |
23 import 'package:analyzer/src/task/dart.dart'; | 23 import 'package:analyzer/src/task/dart.dart'; |
24 import 'package:analyzer/src/task/html.dart'; | 24 import 'package:analyzer/src/task/html.dart'; |
25 import 'package:analyzer/task/dart.dart'; | 25 import 'package:analyzer/task/dart.dart'; |
26 import 'package:analyzer/task/model.dart'; | 26 import 'package:analyzer/task/model.dart'; |
27 import 'package:html/dom.dart' as html; | 27 import 'package:html/dom.dart' as html; |
28 | 28 |
29 /** | 29 /** |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 void writeElement(Element element) { | 267 void writeElement(Element element) { |
268 _write('an instance of '); | 268 _write('an instance of '); |
269 _write(element.runtimeType); | 269 _write(element.runtimeType); |
270 if (element.name == null) { | 270 if (element.name == null) { |
271 _write(' with no name'); | 271 _write(' with no name'); |
272 } else { | 272 } else { |
273 _write(' named '); | 273 _write(' named '); |
274 _write(element.name); | 274 _write(element.name); |
275 } | 275 } |
276 } | 276 } |
| 277 |
277 expectedElements.forEach((String name, Element element) { | 278 expectedElements.forEach((String name, Element element) { |
278 _write('Expected '); | 279 _write('Expected '); |
279 writeElement(element); | 280 writeElement(element); |
280 _writeln('; found no match'); | 281 _writeln('; found no match'); |
281 }); | 282 }); |
282 extraElements.forEach((Element element) { | 283 extraElements.forEach((Element element) { |
283 _write('Expected nothing; found '); | 284 _write('Expected nothing; found '); |
284 writeElement(element); | 285 writeElement(element); |
285 }); | 286 }); |
286 } | 287 } |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 _write('Expected a '); | 597 _write('Expected a '); |
597 _write(descriptor); | 598 _write(descriptor); |
598 _write(' named '); | 599 _write(' named '); |
599 _write(expected.name); | 600 _write(expected.name); |
600 _write('; found a '); | 601 _write('; found a '); |
601 _write(descriptor); | 602 _write(descriptor); |
602 _write(' named '); | 603 _write(' named '); |
603 _write(actual.name); | 604 _write(actual.name); |
604 } | 605 } |
605 } | 606 } |
| 607 |
606 void compareTypeArguments( | 608 void compareTypeArguments( |
607 ParameterizedType expected, ParameterizedType actual) { | 609 ParameterizedType expected, ParameterizedType actual) { |
608 List<DartType> expectedArguments = expected.typeArguments; | 610 List<DartType> expectedArguments = expected.typeArguments; |
609 List<DartType> actualArguments = actual.typeArguments; | 611 List<DartType> actualArguments = actual.typeArguments; |
610 int expectedLength = expectedArguments.length; | 612 int expectedLength = expectedArguments.length; |
611 if (expectedLength != actualArguments.length) { | 613 if (expectedLength != actualArguments.length) { |
612 _write('Expected '); | 614 _write('Expected '); |
613 _write(expectedLength); | 615 _write(expectedLength); |
614 _write(' type arguments; found '); | 616 _write(' type arguments; found '); |
615 _write(actualArguments.length); | 617 _write(actualArguments.length); |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1590 for (String name in names) { | 1592 for (String name in names) { |
1591 if (first) { | 1593 if (first) { |
1592 first = false; | 1594 first = false; |
1593 } else { | 1595 } else { |
1594 buffer.write(', '); | 1596 buffer.write(', '); |
1595 } | 1597 } |
1596 buffer.write(name); | 1598 buffer.write(name); |
1597 } | 1599 } |
1598 buffer.write('}'); | 1600 buffer.write('}'); |
1599 } | 1601 } |
| 1602 |
1600 bool needsNewline = false; | 1603 bool needsNewline = false; |
1601 if (missingNames.isNotEmpty) { | 1604 if (missingNames.isNotEmpty) { |
1602 buffer.write('Has '); | 1605 buffer.write('Has '); |
1603 write('missing names', missingNames); | 1606 write('missing names', missingNames); |
1604 needsNewline = true; | 1607 needsNewline = true; |
1605 } | 1608 } |
1606 if (extraNames.isNotEmpty) { | 1609 if (extraNames.isNotEmpty) { |
1607 if (needsNewline) { | 1610 if (needsNewline) { |
1608 buffer.write('</p><p>'); | 1611 buffer.write('</p><p>'); |
1609 } | 1612 } |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1773 * Determine whether or not there is any interesting difference between the | 1776 * Determine whether or not there is any interesting difference between the |
1774 * original and cloned values. | 1777 * original and cloned values. |
1775 */ | 1778 */ |
1776 void _performComparison() { | 1779 void _performComparison() { |
1777 StringBuffer buffer = new StringBuffer(); | 1780 StringBuffer buffer = new StringBuffer(); |
1778 if (!_compareObjects(cloneValue, originalValue, buffer)) { | 1781 if (!_compareObjects(cloneValue, originalValue, buffer)) { |
1779 description = buffer.toString(); | 1782 description = buffer.toString(); |
1780 } | 1783 } |
1781 } | 1784 } |
1782 } | 1785 } |
OLD | NEW |