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

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

Issue 1893703002: Support for a.b.c.d extract property sequence. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: tweak Created 4 years, 8 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 void test_infer_extractProperty_getter() { 239 void test_infer_extractProperty_getter() {
240 checkFile(r''' 240 checkFile(r'''
241 var a = 1.isEven; 241 var a = 1.isEven;
242 var b = 2.isNaN; 242 var b = 2.isNaN;
243 var c = 3.foo; 243 var c = 3.foo;
244 var d = foo.bar; 244 var d = foo.bar;
245 '''); 245 ''');
246 } 246 }
247 247
248 void test_infer_extractProperty_getter_sequence() {
249 var unit = checkFile(r'''
250 class A {
251 B b = new B();
252 }
253 class B {
254 C c = new C();
255 }
256 class C {
257 int d;
258 }
259 var a = new A();
260 var v = a.b.c.d;
261 ''');
262 expect(unit.topLevelVariables[1].type.toString(), 'int');
263 }
264
265
266 void test_infer_extractProperty_getter_sequence_generic() {
267 var unit = checkFile(r'''
268 class A<T> {
269 B<T> b = new B<T>();
270 }
271 class B<K> {
272 C<List<K>, int> c = new C<List<K>, int>();
273 }
274 class C<K, V> {
275 Map<K, V> d;
276 }
277 var a = new A<double>();
278 var v = a.b.c.d;
279 ''');
280 expect(unit.topLevelVariables[1].type.toString(), 'Map<List<double>, int>');
281 }
282
248 void test_infer_extractProperty_method() { 283 void test_infer_extractProperty_method() {
249 checkFile(r''' 284 checkFile(r'''
250 var a = 1.round; 285 var a = 1.round;
251 '''); 286 ''');
252 } 287 }
253 288
254 void test_infer_invokeConstructor_factoryRedirected() { 289 void test_infer_invokeConstructor_factoryRedirected() {
255 checkFile(r''' 290 checkFile(r'''
256 class A { 291 class A {
257 factory A() = B; 292 factory A() = B;
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 } 605 }
571 606
572 UnlinkedUnit definingUnit = _getUnlinkedUnit(librarySource); 607 UnlinkedUnit definingUnit = _getUnlinkedUnit(librarySource);
573 LinkedLibraryBuilder linkedLibrary = 608 LinkedLibraryBuilder linkedLibrary =
574 prelink(definingUnit, getPart, getImport); 609 prelink(definingUnit, getPart, getImport);
575 linkedLibrary.dependencies.skip(1).forEach((LinkedDependency d) { 610 linkedLibrary.dependencies.skip(1).forEach((LinkedDependency d) {
576 _serializeLibrary(resolveRelativeUri(d.uri)); 611 _serializeLibrary(resolveRelativeUri(d.uri));
577 }); 612 });
578 } 613 }
579 } 614 }
OLDNEW
« pkg/analyzer/lib/src/summary/link.dart ('K') | « pkg/analyzer/lib/src/summary/link.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698