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

Unified Diff: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/index/IndexContributorTest.java

Issue 26466005: Support for parsing 'class name = mixinApplication', report error for 'typedef name = mixinApplicat… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changes for review comments. Created 7 years, 2 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: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/index/IndexContributorTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/index/IndexContributorTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/index/IndexContributorTest.java
index 26c2d2cb16daff3fb9f88e371dbc1993bbcd8ae5..5fe9e649cd16cca4049439216b84575ecc9cfbc0 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/index/IndexContributorTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/index/IndexContributorTest.java
@@ -236,7 +236,7 @@ public class IndexContributorTest extends AbstractDartTest {
parseTestUnit(
"// filler filler filler filler filler filler filler filler filler filler",
"class Mix {}",
- "typedef MyClass = Object with Mix;");
+ "class MyClass = Object with Mix;");
Element classElement = findElement("MyClass =");
// index
index.visitCompilationUnit(testUnit);
@@ -580,7 +580,7 @@ public class IndexContributorTest extends AbstractDartTest {
"// filler filler filler filler filler filler filler filler filler filler",
"class A {} // 1",
"class B {} // 2",
- "typedef C = A with B; // 3",
+ "class C = A with B; // 3",
"");
// prepare elements
ClassElement classElementA = findElement("A {} // 1");
@@ -623,7 +623,7 @@ public class IndexContributorTest extends AbstractDartTest {
"// filler filler filler filler filler filler filler filler filler filler",
"class A {} // 1",
"class B {} // 2",
- "typedef C = Object with A implements B; // 3",
+ "class C = Object with A implements B; // 3",
"");
// prepare elements
ClassElement classElementB = findElement("B {} // 2");
@@ -735,7 +735,7 @@ public class IndexContributorTest extends AbstractDartTest {
parseTestUnit(
"// filler filler filler filler filler filler filler filler filler filler",
"class A {} // 1",
- "typedef C = Object with A; // 2",
+ "class C = Object with A; // 2",
"");
// prepare elements
ClassElement classElementA = findElement("A {} // 1");
@@ -912,7 +912,7 @@ public class IndexContributorTest extends AbstractDartTest {
parseTestUnit(
"// filler filler filler filler filler filler filler filler filler filler",
"class A {}",
- "typedef B = Object with A;",
+ "class B = Object with A;",
"topLevelFunction(B p) {",
" B v;",
"}");
@@ -1040,6 +1040,26 @@ public class IndexContributorTest extends AbstractDartTest {
}
}
+ public void test_isReferencedBy_FunctionTypeAliasElement() throws Exception {
+ parseTestUnit(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "typedef A();",
+ "main2(A p) {",
+ "}");
+ // prepare elements
+ ParameterElement pElement = findElement("p) {");
+ FunctionTypeAliasElement classElementA = findElement("A();");
+ // index
+ index.visitCompilationUnit(testUnit);
+ // verify
+ List<RecordedRelation> relations = captureRecordedRelations();
+ assertRecordedRelation(
+ relations,
+ classElementA,
+ IndexConstants.IS_REFERENCED_BY,
+ new ExpectedLocation(pElement, findOffset("A p)"), "A"));
+ }
+
/**
* There was bug in the AST structure, when single {@link Comment} was cloned and assigned to both
* {@link FieldDeclaration} and {@link VariableDeclaration}. This caused duplicate indexing. Here
@@ -1358,26 +1378,6 @@ public class IndexContributorTest extends AbstractDartTest {
new ExpectedLocation(mainElement, findOffset("p: 1"), "p"));
}
- public void test_isReferencedBy_TypeAliasElement() throws Exception {
- parseTestUnit(
- "// filler filler filler filler filler filler filler filler filler filler",
- "typedef A();",
- "main2(A p) {",
- "}");
- // prepare elements
- ParameterElement pElement = findElement("p) {");
- FunctionTypeAliasElement classElementA = findElement("A();");
- // index
- index.visitCompilationUnit(testUnit);
- // verify
- List<RecordedRelation> relations = captureRecordedRelations();
- assertRecordedRelation(
- relations,
- classElementA,
- IndexConstants.IS_REFERENCED_BY,
- new ExpectedLocation(pElement, findOffset("A p)"), "A"));
- }
-
public void test_isReferencedBy_typeInVariableList() throws Exception {
parseTestUnit(
"// filler filler filler filler filler filler filler filler filler filler",

Powered by Google App Engine
This is Rietveld 408576698