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

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

Issue 2012263002: Store expression function closures summaries when needed for type inference. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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/lib/src/summary/summarize_ast.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 7049 matching lines...) Expand 10 before | Expand all | Expand 10 after
7060 if (skipNonConstInitializers) { 7060 if (skipNonConstInitializers) {
7061 return; 7061 return;
7062 } 7062 }
7063 UnlinkedVariable variable = serializeVariableText(''' 7063 UnlinkedVariable variable = serializeVariableText('''
7064 final v = ((a, b) => 42)(1, 2); 7064 final v = ((a, b) => 42)(1, 2);
7065 '''); 7065 ''');
7066 _assertUnlinkedConst(variable.initializer.bodyExpr, 7066 _assertUnlinkedConst(variable.initializer.bodyExpr,
7067 isValidConst: false, operators: [UnlinkedConstOperation.pushNull]); 7067 isValidConst: false, operators: [UnlinkedConstOperation.pushNull]);
7068 } 7068 }
7069 7069
7070 test_expr_inClosure() {
7071 if (skipNonConstInitializers) {
7072 return;
7073 }
7074 UnlinkedVariable variable = serializeVariableText('var v = () => 1;');
7075 _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
7076 operators: [UnlinkedConstOperation.pushInt], ints: [1]);
7077 }
7078
7079 test_expr_inClosure_noTypeInferenceNeeded() {
7080 // We don't serialize closure body expressions for closures that don't need
7081 // to participate in type inference.
7082 UnlinkedVariable variable = serializeVariableText('Object v = () => 1;');
7083 expect(variable.initializer.localFunctions[0].bodyExpr, isNull);
7084 }
7085
7070 test_expr_invokeMethod_instance() { 7086 test_expr_invokeMethod_instance() {
7071 if (skipNonConstInitializers) { 7087 if (skipNonConstInitializers) {
7072 return; 7088 return;
7073 } 7089 }
7074 UnlinkedVariable variable = serializeVariableText(''' 7090 UnlinkedVariable variable = serializeVariableText('''
7075 class C { 7091 class C {
7076 int m(a, {b, c}) => 42; 7092 int m(a, {b, c}) => 42;
7077 } 7093 }
7078 final v = new C().m(1, b: 2, c: 3); 7094 final v = new C().m(1, b: 2, c: 3);
7079 '''); 7095 ''');
(...skipping 3188 matching lines...) Expand 10 before | Expand all | Expand 10 after
10268 class _PrefixExpectation { 10284 class _PrefixExpectation {
10269 final ReferenceKind kind; 10285 final ReferenceKind kind;
10270 final String name; 10286 final String name;
10271 final String absoluteUri; 10287 final String absoluteUri;
10272 final String relativeUri; 10288 final String relativeUri;
10273 final int numTypeParameters; 10289 final int numTypeParameters;
10274 10290
10275 _PrefixExpectation(this.kind, this.name, 10291 _PrefixExpectation(this.kind, this.name,
10276 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); 10292 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0});
10277 } 10293 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_ast.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698