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

Side by Side Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 2189783002: Record names of classes which unnamed constructor are used in SuperConstructorInvocation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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) 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 analyzer.test.src.task.dart_test; 5 library analyzer.test.src.task.dart_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/token.dart'; 8 import 'package:analyzer/dart/ast/token.dart';
9 import 'package:analyzer/dart/ast/visitor.dart'; 9 import 'package:analyzer/dart/ast/visitor.dart';
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 3677 matching lines...) Expand 10 before | Expand all | Expand 10 after
3688 } 3688 }
3689 } 3689 }
3690 '''); 3690 ''');
3691 expect(info.names, unorderedEquals(['A', 'B', 'C'])); 3691 expect(info.names, unorderedEquals(['A', 'B', 'C']));
3692 expect(info.superToSubs.keys, isEmpty); 3692 expect(info.superToSubs.keys, isEmpty);
3693 expect(info.instantiatedNames, isEmpty); 3693 expect(info.instantiatedNames, isEmpty);
3694 expect(info.userToDependsOn.keys, unorderedEquals(['U'])); 3694 expect(info.userToDependsOn.keys, unorderedEquals(['U']));
3695 expect(info.userToDependsOn['U'], unorderedEquals(['A', 'B'])); 3695 expect(info.userToDependsOn['U'], unorderedEquals(['A', 'B']));
3696 } 3696 }
3697 3697
3698 test_class_extendedUsedUnnamedConstructorNames() {
3699 ReferencedNames info = _computeReferencedNames('''
3700 class U1 extends A {
3701 U1() : super();
3702 }
3703 class U2 extends p.B {
3704 U2() : super();
3705 }
3706 class U3 extends p.C {
3707 U3() : super.named();
3708 }
3709 ''');
3710 expect(
3711 info.extendedUsedUnnamedConstructorNames, unorderedEquals(['A', 'B']));
3712 }
3713
3698 test_class_field() { 3714 test_class_field() {
3699 ReferencedNames info = _computeReferencedNames(''' 3715 ReferencedNames info = _computeReferencedNames('''
3700 class U { 3716 class U {
3701 A f = new B(); 3717 A f = new B();
3702 } 3718 }
3703 '''); 3719 ''');
3704 expect(info.names, unorderedEquals(['A', 'B'])); 3720 expect(info.names, unorderedEquals(['A', 'B']));
3705 expect(info.superToSubs.keys, isEmpty); 3721 expect(info.superToSubs.keys, isEmpty);
3706 expect(info.instantiatedNames, unorderedEquals(['B'])); 3722 expect(info.instantiatedNames, unorderedEquals(['B']));
3707 expect(info.userToDependsOn.keys, unorderedEquals(['U'])); 3723 expect(info.userToDependsOn.keys, unorderedEquals(['U']));
(...skipping 2075 matching lines...) Expand 10 before | Expand all | Expand 10 after
5783 /** 5799 /**
5784 * Fill [errorListener] with [result] errors in the current [task]. 5800 * Fill [errorListener] with [result] errors in the current [task].
5785 */ 5801 */
5786 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { 5802 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) {
5787 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; 5803 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>;
5788 expect(errors, isNotNull, reason: result.name); 5804 expect(errors, isNotNull, reason: result.name);
5789 errorListener = new GatheringErrorListener(); 5805 errorListener = new GatheringErrorListener();
5790 errorListener.addAll(errors); 5806 errorListener.addAll(errors);
5791 } 5807 }
5792 } 5808 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698