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

Side by Side Diff: pkg/analyzer/test/src/summary/summary_common.dart

Issue 1762663002: Add support for ConstructorElementImpl.isCycleFree to summaries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.summary.summary_common; 5 library analyzer.test.src.summary.summary_common;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/dart/ast/ast.dart'; 8 import 'package:analyzer/dart/ast/ast.dart';
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/src/dart/scanner/reader.dart'; 10 import 'package:analyzer/src/dart/scanner/reader.dart';
(...skipping 3782 matching lines...) Expand 10 before | Expand all | Expand 10 after
3793 executables: serializeClassText('class C { C(); }').executables); 3793 executables: serializeClassText('class C { C(); }').executables);
3794 expect(executable.returnType, isNull); 3794 expect(executable.returnType, isNull);
3795 } 3795 }
3796 3796
3797 test_constructor_return_type_parameterized() { 3797 test_constructor_return_type_parameterized() {
3798 UnlinkedExecutable executable = findExecutable('', 3798 UnlinkedExecutable executable = findExecutable('',
3799 executables: serializeClassText('class C<T, U> { C(); }').executables); 3799 executables: serializeClassText('class C<T, U> { C(); }').executables);
3800 expect(executable.returnType, isNull); 3800 expect(executable.returnType, isNull);
3801 } 3801 }
3802 3802
3803 test_constructor_withCycles_const() {
3804 serializeLibraryText('''
3805 class C {
3806 final x;
3807 const C() : x = const D();
3808 }
3809 class D {
3810 final x;
3811 const D() : x = const C();
3812 }
3813 class E {
3814 final x;
3815 const E() : x = null;
3816 }
3817 ''');
3818 int classCConstCycleSlot = findClass('C').executables[0].constCycleSlot;
3819 expect(classCConstCycleSlot, isNot(0));
3820 int classDConstCycleSlot = findClass('D').executables[0].constCycleSlot;
3821 expect(classDConstCycleSlot, isNot(0));
3822 int classEConstCycleSlot = findClass('E').executables[0].constCycleSlot;
3823 expect(classEConstCycleSlot, isNot(0));
3824 if (!skipFullyLinkedData) {
3825 expect(definingUnit.constCycles, contains(classCConstCycleSlot));
3826 expect(definingUnit.constCycles, contains(classDConstCycleSlot));
3827 expect(definingUnit.constCycles, isNot(contains(classEConstCycleSlot)));
3828 }
3829 }
3830
3831 test_constructor_withCycles_nonConst() {
3832 serializeLibraryText('''
3833 class C {
3834 final x;
3835 C() : x = new D();
3836 }
3837 class D {
3838 final x;
3839 D() : x = new C();
3840 }
3841 ''');
3842 expect(findClass('C').executables[0].constCycleSlot, 0);
3843 expect(findClass('D').executables[0].constCycleSlot, 0);
3844 }
3845
3803 test_dependencies_export_to_export_unused() { 3846 test_dependencies_export_to_export_unused() {
3804 addNamedSource('/a.dart', 'export "b.dart";'); 3847 addNamedSource('/a.dart', 'export "b.dart";');
3805 addNamedSource('/b.dart', ''); 3848 addNamedSource('/b.dart', '');
3806 serializeLibraryText('export "a.dart";'); 3849 serializeLibraryText('export "a.dart";');
3807 // The main test library depends on b.dart, even though it doesn't 3850 // The main test library depends on b.dart, even though it doesn't
3808 // re-export any names defined in b.dart, because a change to b.dart might 3851 // re-export any names defined in b.dart, because a change to b.dart might
3809 // cause it to start exporting a name that the main test library *does* 3852 // cause it to start exporting a name that the main test library *does*
3810 // use. 3853 // use.
3811 checkHasDependency(absUri('/b.dart'), 'b.dart'); 3854 checkHasDependency(absUri('/b.dart'), 'b.dart');
3812 } 3855 }
(...skipping 3629 matching lines...) Expand 10 before | Expand all | Expand 10 after
7442 class _PrefixExpectation { 7485 class _PrefixExpectation {
7443 final ReferenceKind kind; 7486 final ReferenceKind kind;
7444 final String name; 7487 final String name;
7445 final String absoluteUri; 7488 final String absoluteUri;
7446 final String relativeUri; 7489 final String relativeUri;
7447 final int numTypeParameters; 7490 final int numTypeParameters;
7448 7491
7449 _PrefixExpectation(this.kind, this.name, 7492 _PrefixExpectation(this.kind, this.name,
7450 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); 7493 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0});
7451 } 7494 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698