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

Unified Diff: pkg/analyzer/test/src/summary/summary_test.dart

Issue 1601973006: Split _LibrarySerializer into two classes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_elements.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/summary/summary_test.dart
diff --git a/pkg/analyzer/test/src/summary/summary_test.dart b/pkg/analyzer/test/src/summary/summary_test.dart
index 41692ab1fd7fbd628539443b956b49c0bea51251..3d8d0623887c8fa40749346cf861949ee905e94d 100644
--- a/pkg/analyzer/test/src/summary/summary_test.dart
+++ b/pkg/analyzer/test/src/summary/summary_test.dart
@@ -582,11 +582,15 @@ abstract class SummaryTest {
* type.
*/
void checkUnresolvedTypeRef(
- TypeRef typeRef, String expectedPrefix, String expectedName) {
+ TypeRef typeRef, String expectedPrefix, String expectedName,
+ {LinkedUnit linkedSourceUnit, UnlinkedUnit unlinkedSourceUnit}) {
// When serializing from the element model, unresolved type refs lose their
// name.
checkTypeRef(typeRef, null, null, checkAstDerivedData ? expectedName : null,
- expectedPrefix: expectedPrefix, expectedKind: ReferenceKind.unresolved);
+ expectedPrefix: expectedPrefix,
+ expectedKind: ReferenceKind.unresolved,
+ linkedSourceUnit: linkedSourceUnit,
+ unlinkedSourceUnit: unlinkedSourceUnit);
}
fail_constExpr_pushInt_shiftOr() {
@@ -3909,6 +3913,21 @@ typedef F();''';
expect(type.typeParameters[1].name, 'U');
}
+ test_unresolved_reference_in_multiple_parts() {
+ addNamedSource('/a.dart', 'part of foo; int x; Unresolved y;');
+ serializeLibraryText('library foo; part "a.dart"; Unresolved z;',
+ allowErrors: true);
+ // The unresolved types in the defining compilation unit and the part
+ // should both work correctly even though they use different reference
+ // indices.
+ checkUnresolvedTypeRef(
+ unlinkedUnits[0].variables[0].type, null, 'Unresolved');
+ checkUnresolvedTypeRef(
+ unlinkedUnits[1].variables[1].type, null, 'Unresolved',
+ linkedSourceUnit: linked.units[1],
+ unlinkedSourceUnit: unlinkedUnits[1]);
+ }
+
test_variable() {
String text = 'int i;';
UnlinkedVariable v = serializeVariableText(text, variableName: 'i');
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_elements.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698