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

Unified Diff: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java

Issue 15409002: Report CTEC.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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/resolver/NonErrorResolverTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java
index c8286da06a5fd2f26f4f72029dd1d43aec6e2a42..d7eb310ac66e1ce1afd8903e1c668a825607750b 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java
@@ -545,6 +545,159 @@ public class NonErrorResolverTest extends ResolverTestCase {
verify(source);
}
+ public void test_implicitThisReferenceInInitializer_constructorName() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " A.named() {}",
+ "}",
+ "class B {",
+ " var v;",
+ " B() : v = new A.named();",
+ "}"));
+ resolve(source);
+ assertNoErrors();
+ verify(source);
+ }
+
+ public void test_implicitThisReferenceInInitializer_prefixedIdentifier() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " var f;",
+ "}",
+ "class B {",
+ " var v;",
+ " B(A a) : v = a.f;",
+ "}"));
+ resolve(source);
+ assertNoErrors();
+ verify(source);
+ }
+
+ public void test_implicitThisReferenceInInitializer_qualifiedMethodInvocation() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " f() {}",
+ "}",
+ "class B {",
+ " var v;",
+ " B() : v = new A().f();",
+ "}"));
+ resolve(source);
+ assertNoErrors();
+ verify(source);
+ }
+
+ public void test_implicitThisReferenceInInitializer_qualifiedPropertyAccess() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " var f;",
+ "}",
+ "class B {",
+ " var v;",
+ " B() : v = new A().f;",
+ "}"));
+ resolve(source);
+ assertNoErrors();
+ verify(source);
+ }
+
+ public void test_implicitThisReferenceInInitializer_staticField_superClass() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " static var f;",
+ "}",
+ "class B extends A {",
+ " var v;",
+ " B() : v = f;",
+ "}"));
+ resolve(source);
+ assertNoErrors();
+ verify(source);
+ }
+
+ public void test_implicitThisReferenceInInitializer_staticField_thisClass() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " var v;",
+ " A() : v = f;",
+ " static var f;",
+ "}"));
+ resolve(source);
+ assertNoErrors();
+ verify(source);
+ }
+
+ public void test_implicitThisReferenceInInitializer_staticGetter() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " var v;",
+ " A() : v = f;",
+ " static get f => 42;",
+ "}"));
+ resolve(source);
+ assertNoErrors();
+ verify(source);
+ }
+
+ public void test_implicitThisReferenceInInitializer_staticMethod() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " var v;",
+ " A() : v = f();",
+ " static f() => 42;",
+ "}"));
+ resolve(source);
+ assertNoErrors();
+ verify(source);
+ }
+
+ public void test_implicitThisReferenceInInitializer_topLevelField() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " var v;",
+ " A() : v = f;",
+ "}",
+ "var f = 42;"));
+ resolve(source);
+ assertNoErrors();
+ verify(source);
+ }
+
+ public void test_implicitThisReferenceInInitializer_topLevelFunction() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " var v;",
+ " A() : v = f();",
+ "}",
+ "f() => 42;"));
+ resolve(source);
+ assertNoErrors();
+ verify(source);
+ }
+
+ public void test_implicitThisReferenceInInitializer_topLevelGetter() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " var v;",
+ " A() : v = f;",
+ "}",
+ "get f = >42;"));
+ resolve(source);
+ assertNoErrors();
+ verify(source);
+ }
+
+ public void test_implicitThisReferenceInInitializer_typeVariable() throws Exception {
+ Source source = addSource(createSource(//
+ "class A<T> {",
+ " var v;",
+ " A(p) : v = (p is T);",
+ "}"));
+ resolve(source);
+ assertNoErrors();
+ verify(source);
+ }
+
public void test_importDuplicatedLibraryName() throws Exception {
Source source = addSource(createSource(//
"library test;",

Powered by Google App Engine
This is Rietveld 408576698