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

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

Issue 1689283002: Serialize parameters visible ranges. (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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/src/summary/summary_common.dart
diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
index b33aa206b98554a3c7c813137e585ed048c5dc95..b03d849f466d71030150526c59d0257c948a2433 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -4279,6 +4279,19 @@ int foo(int a, String b) => 0;
expect(executable.parameters[0].nameOffset, text.indexOf('x'));
}
+ test_executable_param_visibleRange() {
Paul Berry 2016/02/11 21:10:39 Add tests to verify that visibleLength and visible
scheglov 2016/02/11 22:26:20 Done.
+ String text = r'''
+f(x) { // 1
+ f2(y) { // 2
+ } // 3
+} // 4
+''';
+ UnlinkedExecutable f = serializeExecutableText(text);
+ UnlinkedExecutable f2 = f.localFunctions[0];
+ _assertParameterVisible(text, f.parameters[0], '{ // 1', '} // 4');
+ _assertParameterVisible(text, f2.parameters[0], '{ // 2', '} // 3');
+ }
+
test_executable_param_no_flags() {
UnlinkedExecutable executable = serializeExecutableText('f(x) {}');
expect(executable.parameters[0].isFunctionTyped, isFalse);
@@ -6552,6 +6565,15 @@ var v;''';
expect(v.visibleOffset, expectedVisibleOffset);
expect(v.visibleLength, expectedVisibleLength);
}
+
+ void _assertParameterVisible(
+ String code, UnlinkedParam p, String visibleBegin, String visibleEnd) {
+ int expectedVisibleOffset = code.indexOf(visibleBegin);
+ int expectedVisibleLength =
+ code.indexOf(visibleEnd) - expectedVisibleOffset + 1;
+ expect(p.visibleOffset, expectedVisibleOffset);
+ expect(p.visibleLength, expectedVisibleLength);
+ }
}
/**
« pkg/analyzer/lib/src/summary/idl.dart ('K') | « 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