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

Side by Side Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 2624283003: Revert "Add support for generic function type syntax, part 1" (TBR) (Closed)
Patch Set: Created 3 years, 11 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.test.generated.resolver_test; 5 library analyzer.test.generated.resolver_test;
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/standard_ast_factory.dart'; 10 import 'package:analyzer/dart/ast/standard_ast_factory.dart';
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 */ 403 */
404 List<Expression> _unresolvedExpressions = new List<Expression>(); 404 List<Expression> _unresolvedExpressions = new List<Expression>();
405 405
406 /** 406 /**
407 * A list containing all of the AST Expression nodes for which a propagated ty pe was computed but 407 * A list containing all of the AST Expression nodes for which a propagated ty pe was computed but
408 * where that type was not more specific than the static type. 408 * where that type was not more specific than the static type.
409 */ 409 */
410 List<Expression> _invalidlyPropagatedExpressions = new List<Expression>(); 410 List<Expression> _invalidlyPropagatedExpressions = new List<Expression>();
411 411
412 /** 412 /**
413 * The TypeAnnotation nodes that were not resolved. 413 * A list containing all of the AST TypeName nodes that were not resolved.
414 */ 414 */
415 List<TypeAnnotation> _unresolvedTypes = new List<TypeAnnotation>(); 415 List<TypeName> _unresolvedTypes = new List<TypeName>();
416 416
417 /** 417 /**
418 * Counter for the number of Expression nodes visited that are resolved. 418 * Counter for the number of Expression nodes visited that are resolved.
419 */ 419 */
420 int _resolvedExpressionCount = 0; 420 int _resolvedExpressionCount = 0;
421 421
422 /** 422 /**
423 * Counter for the number of Expression nodes visited that have propagated typ e information. 423 * Counter for the number of Expression nodes visited that have propagated typ e information.
424 */ 424 */
425 int _propagatedExpressionCount = 0; 425 int _propagatedExpressionCount = 0;
426 426
427 /** 427 /**
428 * Counter for the number of TypeName nodes visited that are resolved. 428 * Counter for the number of TypeName nodes visited that are resolved.
429 */ 429 */
430 int _resolvedTypeCount = 0; 430 int _resolvedTypeCount = 0;
431 431
432 /** 432 /**
433 * Assert that all of the visited nodes have a static type associated with the m. 433 * Assert that all of the visited nodes have a static type associated with the m.
434 */ 434 */
435 void assertResolved() { 435 void assertResolved() {
436 if (!_unresolvedExpressions.isEmpty || !_unresolvedTypes.isEmpty) { 436 if (!_unresolvedExpressions.isEmpty || !_unresolvedTypes.isEmpty) {
437 StringBuffer buffer = new StringBuffer(); 437 StringBuffer buffer = new StringBuffer();
438 int unresolvedTypeCount = _unresolvedTypes.length; 438 int unresolvedTypeCount = _unresolvedTypes.length;
439 if (unresolvedTypeCount > 0) { 439 if (unresolvedTypeCount > 0) {
440 buffer.write("Failed to resolve "); 440 buffer.write("Failed to resolve ");
441 buffer.write(unresolvedTypeCount); 441 buffer.write(unresolvedTypeCount);
442 buffer.write(" of "); 442 buffer.write(" of ");
443 buffer.write(_resolvedTypeCount + unresolvedTypeCount); 443 buffer.write(_resolvedTypeCount + unresolvedTypeCount);
444 buffer.writeln(" type names:"); 444 buffer.writeln(" type names:");
445 for (TypeAnnotation identifier in _unresolvedTypes) { 445 for (TypeName identifier in _unresolvedTypes) {
446 buffer.write(" "); 446 buffer.write(" ");
447 buffer.write(identifier.toString()); 447 buffer.write(identifier.toString());
448 buffer.write(" ("); 448 buffer.write(" (");
449 buffer.write(_getFileName(identifier)); 449 buffer.write(_getFileName(identifier));
450 buffer.write(" : "); 450 buffer.write(" : ");
451 buffer.write(identifier.offset); 451 buffer.write(identifier.offset);
452 buffer.writeln(")"); 452 buffer.writeln(")");
453 } 453 }
454 } 454 }
455 int unresolvedExpressionCount = _unresolvedExpressions.length; 455 int unresolvedExpressionCount = _unresolvedExpressions.length;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 identical(node, parent.fieldName)) { 569 identical(node, parent.fieldName)) {
570 return null; 570 return null;
571 } else if (node.staticElement is PrefixElement) { 571 } else if (node.staticElement is PrefixElement) {
572 // Prefixes don't have a type. 572 // Prefixes don't have a type.
573 return null; 573 return null;
574 } 574 }
575 return super.visitSimpleIdentifier(node); 575 return super.visitSimpleIdentifier(node);
576 } 576 }
577 577
578 @override 578 @override
579 Object visitTypeAnnotation(TypeAnnotation node) {
580 if (node.type == null) {
581 _unresolvedTypes.add(node);
582 } else {
583 _resolvedTypeCount++;
584 }
585 return super.visitTypeAnnotation(node);
586 }
587
588 @override
589 Object visitTypeName(TypeName node) { 579 Object visitTypeName(TypeName node) {
590 // Note: do not visit children from this node, the child SimpleIdentifier in 580 // Note: do not visit children from this node, the child SimpleIdentifier in
591 // TypeName (i.e. "String") does not have a static type defined. 581 // TypeName (i.e. "String") does not have a static type defined.
592 // TODO(brianwilkerson) Not visiting the children means that we won't catch
593 // type arguments that were not resolved.
594 if (node.type == null) { 582 if (node.type == null) {
595 _unresolvedTypes.add(node); 583 _unresolvedTypes.add(node);
596 } else { 584 } else {
597 _resolvedTypeCount++; 585 _resolvedTypeCount++;
598 } 586 }
599 return null; 587 return null;
600 } 588 }
601 589
602 String _getFileName(AstNode node) { 590 String _getFileName(AstNode node) {
603 // TODO (jwren) there are two copies of this method, one here and one in 591 // TODO (jwren) there are two copies of this method, one here and one in
(...skipping 3118 matching lines...) Expand 10 before | Expand all | Expand 10 after
3722 */ 3710 */
3723 class _StaleElement extends ElementImpl { 3711 class _StaleElement extends ElementImpl {
3724 _StaleElement() : super("_StaleElement", -1); 3712 _StaleElement() : super("_StaleElement", -1);
3725 3713
3726 @override 3714 @override
3727 get kind => throw "_StaleElement's kind shouldn't be accessed"; 3715 get kind => throw "_StaleElement's kind shouldn't be accessed";
3728 3716
3729 @override 3717 @override
3730 /*=T*/ accept/*<T>*/(_) => throw "_StaleElement shouldn't be visited"; 3718 /*=T*/ accept/*<T>*/(_) => throw "_StaleElement shouldn't be visited";
3731 } 3719 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/parser_test.dart ('k') | pkg/analyzer/test/generated/utilities_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698