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

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

Issue 1717803003: partial fix for #25220, handles inference for list/map literals (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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.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 6896 matching lines...) Expand 10 before | Expand all | Expand 10 after
6907 expect(initializer.localVariables, isEmpty); 6907 expect(initializer.localVariables, isEmpty);
6908 } 6908 }
6909 6909
6910 test_variable_initializer_noInitializer() { 6910 test_variable_initializer_noInitializer() {
6911 UnlinkedVariable variable = serializeVariableText('var v;'); 6911 UnlinkedVariable variable = serializeVariableText('var v;');
6912 expect(variable.initializer, isNull); 6912 expect(variable.initializer, isNull);
6913 } 6913 }
6914 6914
6915 test_variable_initializer_withLocals() { 6915 test_variable_initializer_withLocals() {
6916 String text = 6916 String text =
6917 'var v = {"1": () { f1() {} var v1; }, "2": () { f2() {} var v2; }};'; 6917 'var v = <dynamic, dynamic>{"1": () { f1() {} var v1; }, '
6918 '"2": () { f2() {} var v2; }};';
6918 UnlinkedVariable variable = serializeVariableText(text); 6919 UnlinkedVariable variable = serializeVariableText(text);
6919 UnlinkedExecutable initializer = variable.initializer; 6920 UnlinkedExecutable initializer = variable.initializer;
6920 expect(initializer, isNotNull); 6921 expect(initializer, isNotNull);
6921 expect(initializer.nameOffset, text.indexOf('{"1')); 6922 expect(initializer.nameOffset, text.indexOf('<dynamic, dynamic>{"1'));
6922 expect(initializer.name, isEmpty); 6923 expect(initializer.name, isEmpty);
6923 expect(initializer.localFunctions, hasLength(2)); 6924 expect(initializer.localFunctions, hasLength(2));
6924 // closure: () { f1() {} var v1; } 6925 // closure: () { f1() {} var v1; }
6925 { 6926 {
6926 UnlinkedExecutable closure = initializer.localFunctions[0]; 6927 UnlinkedExecutable closure = initializer.localFunctions[0];
6927 expect(closure.nameOffset, text.indexOf('() { f1()')); 6928 expect(closure.nameOffset, text.indexOf('() { f1()'));
6928 expect(closure.name, isEmpty); 6929 expect(closure.name, isEmpty);
6929 // closure - f1 6930 // closure - f1
6930 expect(closure.localFunctions, hasLength(1)); 6931 expect(closure.localFunctions, hasLength(1));
6931 expect(closure.localFunctions[0].name, 'f1'); 6932 expect(closure.localFunctions[0].name, 'f1');
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
7155 class _PrefixExpectation { 7156 class _PrefixExpectation {
7156 final ReferenceKind kind; 7157 final ReferenceKind kind;
7157 final String name; 7158 final String name;
7158 final String absoluteUri; 7159 final String absoluteUri;
7159 final String relativeUri; 7160 final String relativeUri;
7160 final int numTypeParameters; 7161 final int numTypeParameters;
7161 7162
7162 _PrefixExpectation(this.kind, this.name, 7163 _PrefixExpectation(this.kind, this.name,
7163 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); 7164 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0});
7164 } 7165 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/context/mock_sdk.dart ('k') | pkg/analyzer/test/src/task/strong/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698