| Index: editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/search/SearchEngineTest.java
|
| diff --git a/editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/search/SearchEngineTest.java b/editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/search/SearchEngineTest.java
|
| index cc4c6c54469df21aaaec019359553eaa3cdf4081..029c4d1fdb74f4494c64fa40479319954da00f0c 100644
|
| --- a/editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/search/SearchEngineTest.java
|
| +++ b/editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/search/SearchEngineTest.java
|
| @@ -679,13 +679,17 @@ public class SearchEngineTest extends TestCase {
|
| }
|
| }
|
|
|
| - public void test_SearchEngine_searchReferences_method_targetTypePropagate() throws Exception {
|
| + /**
|
| + * Type of "target" is propagate from value in variable declaration.
|
| + */
|
| + public void test_SearchEngine_searchReferences_method_typePropagate_declaration()
|
| + throws Exception {
|
| TestProject testProject = new TestProject();
|
| try {
|
| String source = buildSource(
|
| "// filler filler filler filler filler filler filler filler filler filler",
|
| "class A {",
|
| - " test() {}",
|
| + " test(var p) {}",
|
| "}",
|
| "bar() {",
|
| " var a = new A();",
|
| @@ -708,6 +712,39 @@ public class SearchEngineTest extends TestCase {
|
| }
|
| }
|
|
|
| + /**
|
| + * Type of "target" is propagate from the type of "is Type" condition.
|
| + */
|
| + public void test_SearchEngine_searchReferences_method_typePropagate_isType() throws Exception {
|
| + TestProject testProject = new TestProject();
|
| + try {
|
| + String source = buildSource(
|
| + "// filler filler filler filler filler filler filler filler filler filler",
|
| + "class A {",
|
| + " test(var p) {}",
|
| + "}",
|
| + "bar(var v) {",
|
| + " if (v is A) {",
|
| + " v.test(1);",
|
| + " }",
|
| + "}",
|
| + "");
|
| + CompilationUnit unit = testProject.setUnitContent("Test.dart", source);
|
| + indexUnits(unit);
|
| + // find references
|
| + Method method = ((Type) unit.getChildren()[0]).getMethod("test", null);
|
| + List<SearchMatch> matches = getMethodReferences(method);
|
| + assertThat(matches).hasSize(1);
|
| + // assert references
|
| + SearchMatch match = matches.get(0);
|
| + int matchOffset = match.getSourceRange().getOffset();
|
| + assertEquals(source.indexOf("test(1);"), matchOffset);
|
| + assertTrue(match.isQualified());
|
| + } finally {
|
| + testProject.dispose();
|
| + }
|
| + }
|
| +
|
| public void test_SearchEngine_searchReferences_type() throws Exception {
|
| Type type = moneyLibrary.getCompilationUnit("simple_money.dart").getType("SimpleMoney");
|
| SearchEngine engine = createSearchEngine();
|
|
|