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

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

Issue 2351623005: We don't compute propagated types of non-local variables. (Closed)
Patch Set: Created 4 years, 3 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.resynthesize_ast_test; 5 library analyzer.test.src.summary.resynthesize_ast_test;
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/src/dart/element/element.dart'; 9 import 'package:analyzer/src/dart/element/element.dart';
10 import 'package:analyzer/src/generated/engine.dart' 10 import 'package:analyzer/src/generated/engine.dart'
(...skipping 21 matching lines...) Expand all
32 main() { 32 main() {
33 groupSep = ' | '; 33 groupSep = ' | ';
34 defineReflectiveTests(ResynthesizeAstSpecTest); 34 defineReflectiveTests(ResynthesizeAstSpecTest);
35 defineReflectiveTests(ResynthesizeAstStrongTest); 35 defineReflectiveTests(ResynthesizeAstStrongTest);
36 defineReflectiveTests(AstInferredTypeTest); 36 defineReflectiveTests(AstInferredTypeTest);
37 } 37 }
38 38
39 @reflectiveTest 39 @reflectiveTest
40 class AstInferredTypeTest extends AbstractResynthesizeTest 40 class AstInferredTypeTest extends AbstractResynthesizeTest
41 with _AstResynthesizeTestMixin, InferredTypeMixin { 41 with _AstResynthesizeTestMixin, InferredTypeMixin {
42 bool get checkPropagatedTypes {
43 // AST-based summaries do not yet handle propagated types.
44 // TODO(paulberry): fix this.
45 return false;
46 }
47
48 @override 42 @override
49 bool get mayCheckTypesOfLocals => false; 43 bool get mayCheckTypesOfLocals => false;
50 44
51 @override 45 @override
52 void addFile(String content, {String name: '/main.dart'}) { 46 void addFile(String content, {String name: '/main.dart'}) {
53 addLibrarySource(name, content); 47 addLibrarySource(name, content);
54 } 48 }
55 49
56 @override 50 @override
57 CompilationUnitElement checkFile(String content) { 51 CompilationUnitElement checkFile(String content) {
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 /** 893 /**
900 * A test should return `true` to indicate that a missing file at the time of 894 * A test should return `true` to indicate that a missing file at the time of
901 * summary resynthesis shouldn't trigger an error. 895 * summary resynthesis shouldn't trigger an error.
902 */ 896 */
903 bool get allowMissingFiles; 897 bool get allowMissingFiles;
904 } 898 }
905 899
906 abstract class _ResynthesizeAstTest extends ResynthesizeTest 900 abstract class _ResynthesizeAstTest extends ResynthesizeTest
907 with _AstResynthesizeTestMixin { 901 with _AstResynthesizeTestMixin {
908 @override 902 @override
909 bool get checkPropagatedTypes => false;
910
911 @override
912 LibraryElementImpl checkLibrary(String text, 903 LibraryElementImpl checkLibrary(String text,
913 {bool allowErrors: false, bool dumpSummaries: false}) { 904 {bool allowErrors: false, bool dumpSummaries: false}) {
914 Source source = addTestSource(text); 905 Source source = addTestSource(text);
915 LibraryElementImpl resynthesized = _encodeDecodeLibraryElement(source); 906 LibraryElementImpl resynthesized = _encodeDecodeLibraryElement(source);
916 LibraryElementImpl original = context.computeLibraryElement(source); 907 LibraryElementImpl original = context.computeLibraryElement(source);
917 checkLibraryElements(original, resynthesized); 908 checkLibraryElements(original, resynthesized);
918 return resynthesized; 909 return resynthesized;
919 } 910 }
920 911
921 @override 912 @override
922 void compareLocalElementsOfExecutable(ExecutableElement resynthesized, 913 void compareLocalElementsOfExecutable(ExecutableElement resynthesized,
923 ExecutableElement original, String desc) { 914 ExecutableElement original, String desc) {
924 // We don't resynthesize local elements during link. 915 // We don't resynthesize local elements during link.
925 // So, we should not compare them. 916 // So, we should not compare them.
926 } 917 }
927 918
928 @override 919 @override
929 DartSdk createDartSdk() => AbstractContextTest.SHARED_MOCK_SDK; 920 DartSdk createDartSdk() => AbstractContextTest.SHARED_MOCK_SDK;
930 921
931 @override 922 @override
932 TestSummaryResynthesizer encodeDecodeLibrarySource(Source source) { 923 TestSummaryResynthesizer encodeDecodeLibrarySource(Source source) {
933 return _encodeLibrary(source); 924 return _encodeLibrary(source);
934 } 925 }
935 } 926 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698