| OLD | NEW |
| 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 test.src.serialization.elements_test; | 5 library test.src.serialization.elements_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/element.dart'; | 7 import 'package:analyzer/src/generated/element.dart'; |
| 8 import 'package:analyzer/src/generated/source.dart'; | 8 import 'package:analyzer/src/generated/source.dart'; |
| 9 import 'package:analyzer/src/summary/builder.dart'; | 9 import 'package:analyzer/src/summary/builder.dart'; |
| 10 import 'package:analyzer/src/summary/format.dart'; | 10 import 'package:analyzer/src/summary/format.dart'; |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 } | 456 } |
| 457 UnlinkedUnit getUnlinkedSummary(String uri) { | 457 UnlinkedUnit getUnlinkedSummary(String uri) { |
| 458 UnlinkedUnit serializedUnit = unlinkedSummaries[uri]; | 458 UnlinkedUnit serializedUnit = unlinkedSummaries[uri]; |
| 459 if (serializedUnit == null) { | 459 if (serializedUnit == null) { |
| 460 fail('Unexpectedly tried to get unlinked summary for $uri'); | 460 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 461 } | 461 } |
| 462 return serializedUnit; | 462 return serializedUnit; |
| 463 } | 463 } |
| 464 SummaryResynthesizer resynthesizer = new SummaryResynthesizer( | 464 SummaryResynthesizer resynthesizer = new SummaryResynthesizer( |
| 465 analysisContext, | 465 analysisContext, |
| 466 analysisContext.typeProvider, |
| 466 getPrelinkedSummary, | 467 getPrelinkedSummary, |
| 467 getUnlinkedSummary, | 468 getUnlinkedSummary, |
| 468 analysisContext.sourceFactory); | 469 analysisContext.sourceFactory); |
| 469 LibraryElementImpl resynthesized = resynthesizer.getLibraryElement(uri); | 470 LibraryElementImpl resynthesized = resynthesizer.getLibraryElement(uri); |
| 470 // Check that no other summaries needed to be resynthesized to resynthesize | 471 // Check that no other summaries needed to be resynthesized to resynthesize |
| 471 // the library element. | 472 // the library element. |
| 472 expect(resynthesizer.resynthesisCount, 1); | 473 expect(resynthesizer.resynthesisCount, 1); |
| 473 return resynthesized; | 474 return resynthesized; |
| 474 } | 475 } |
| 475 | 476 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 } | 593 } |
| 593 | 594 |
| 594 test_class_getter_static() { | 595 test_class_getter_static() { |
| 595 checkLibrary('class C { static int get x => null; }'); | 596 checkLibrary('class C { static int get x => null; }'); |
| 596 } | 597 } |
| 597 | 598 |
| 598 test_class_getters() { | 599 test_class_getters() { |
| 599 checkLibrary('class C { int get x => null; get y => null; }'); | 600 checkLibrary('class C { int get x => null; get y => null; }'); |
| 600 } | 601 } |
| 601 | 602 |
| 603 test_class_implicitField_getterFirst() { |
| 604 checkLibrary('class C { int get x => 0; void set x(int value) {} }'); |
| 605 } |
| 606 |
| 607 test_class_implicitField_setterFirst() { |
| 608 checkLibrary('class C { void set x(int value) {} int get x => 0; }'); |
| 609 } |
| 610 |
| 602 test_class_interfaces() { | 611 test_class_interfaces() { |
| 603 checkLibrary('class C implements D, E {} class D {} class E {}'); | 612 checkLibrary('class C implements D, E {} class D {} class E {}'); |
| 604 } | 613 } |
| 605 | 614 |
| 606 test_class_method_external() { | 615 test_class_method_external() { |
| 607 checkLibrary('class C { external f(); }'); | 616 checkLibrary('class C { external f(); }'); |
| 608 } | 617 } |
| 609 | 618 |
| 610 test_class_method_params() { | 619 test_class_method_params() { |
| 611 checkLibrary('class C { f(x, y) {} }'); | 620 checkLibrary('class C { f(x, y) {} }'); |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 checkLibrary('import "a/a.dart"; C c; E e; F f;'); | 944 checkLibrary('import "a/a.dart"; C c; E e; F f;'); |
| 936 } | 945 } |
| 937 | 946 |
| 938 test_type_reference_to_import_part() { | 947 test_type_reference_to_import_part() { |
| 939 addLibrarySource('/a.dart', 'library l; part "b.dart";'); | 948 addLibrarySource('/a.dart', 'library l; part "b.dart";'); |
| 940 addNamedSource( | 949 addNamedSource( |
| 941 '/b.dart', 'part of l; class C {} enum E { v } typedef F();'); | 950 '/b.dart', 'part of l; class C {} enum E { v } typedef F();'); |
| 942 checkLibrary('import "a.dart"; C c; E e; F f;'); | 951 checkLibrary('import "a.dart"; C c; E e; F f;'); |
| 943 } | 952 } |
| 944 | 953 |
| 954 test_type_reference_to_import_part2() { |
| 955 addLibrarySource('/a.dart', 'library l; part "p1.dart"; part "p2.dart";'); |
| 956 addNamedSource('/p1.dart', 'part of l; class C1 {}'); |
| 957 addNamedSource('/p2.dart', 'part of l; class C2 {}'); |
| 958 checkLibrary('import "a.dart"; C1 c1; C2 c2;'); |
| 959 } |
| 960 |
| 945 test_type_reference_to_import_part_in_subdir() { | 961 test_type_reference_to_import_part_in_subdir() { |
| 946 addLibrarySource('/a/b.dart', 'library l; part "c.dart";'); | 962 addLibrarySource('/a/b.dart', 'library l; part "c.dart";'); |
| 947 addNamedSource( | 963 addNamedSource( |
| 948 '/a/c.dart', 'part of l; class C {} enum E { v } typedef F();'); | 964 '/a/c.dart', 'part of l; class C {} enum E { v } typedef F();'); |
| 949 checkLibrary('import "a/b.dart"; C c; E e; F f;'); | 965 checkLibrary('import "a/b.dart"; C c; E e; F f;'); |
| 950 } | 966 } |
| 951 | 967 |
| 952 test_type_reference_to_import_relative() { | 968 test_type_reference_to_import_relative() { |
| 953 addLibrarySource('/a.dart', 'class C {} enum E { v } typedef F();'); | 969 addLibrarySource('/a.dart', 'class C {} enum E { v } typedef F();'); |
| 954 checkLibrary('import "a.dart"; C c; E e; F f;'); | 970 checkLibrary('import "a.dart"; C c; E e; F f;'); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 } | 1047 } |
| 1032 | 1048 |
| 1033 test_variable_const() { | 1049 test_variable_const() { |
| 1034 checkLibrary('const int i = 0;'); | 1050 checkLibrary('const int i = 0;'); |
| 1035 } | 1051 } |
| 1036 | 1052 |
| 1037 test_variables() { | 1053 test_variables() { |
| 1038 checkLibrary('int i; int j;'); | 1054 checkLibrary('int i; int j;'); |
| 1039 } | 1055 } |
| 1040 } | 1056 } |
| OLD | NEW |