Chromium Code Reviews| 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); |
| + } |
| } |
| /** |