| Index: compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
|
| diff --git a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
|
| index f1c287972691cdad6080d6cce642b527a7c794e6..7730fcf1797107113a4b017ebb1b9250bc14c965 100644
|
| --- a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
|
| +++ b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
|
| @@ -4,6 +4,8 @@
|
|
|
| package com.google.dart.compiler.resolver;
|
|
|
| +import static com.google.dart.compiler.common.ErrorExpectation.errEx;
|
| +
|
| import com.google.common.base.Joiner;
|
| import com.google.dart.compiler.DartCompilationError;
|
| import com.google.dart.compiler.ErrorCode;
|
| @@ -14,8 +16,6 @@ import com.google.dart.compiler.type.InterfaceType;
|
| import com.google.dart.compiler.type.Type;
|
| import com.google.dart.compiler.type.Types;
|
|
|
| -import static com.google.dart.compiler.common.ErrorExpectation.errEx;
|
| -
|
| import junit.framework.Assert;
|
|
|
| import java.util.List;
|
| @@ -1329,6 +1329,44 @@ public class ResolverTest extends ResolverTestCase {
|
| errEx(ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER, 2, 22, 4));
|
| }
|
|
|
| + /**
|
| + * "this" is not accessible to initializers, so invocation of instance method is error.
|
| + * <p>
|
| + * http://code.google.com/p/dart/issues/detail?id=2477
|
| + */
|
| + public void test_callInstanceMethod_fromInitializer() throws Exception {
|
| + resolveAndTest(
|
| + Joiner.on("\n").join(
|
| + "// filler filler filler filler filler filler filler filler filler filler",
|
| + "class Object {}",
|
| + "class A {",
|
| + " var x;",
|
| + " A() : x = foo() {}",
|
| + " foo() {}",
|
| + "}",
|
| + ""),
|
| + errEx(ResolverErrorCode.INSTANCE_METHOD_FROM_INITIALIZER, 5, 13, 5));
|
| + }
|
| +
|
| + /**
|
| + * "this" is not accessible to initializers, so reference of instance method is error.
|
| + * <p>
|
| + * http://code.google.com/p/dart/issues/detail?id=2477
|
| + */
|
| + public void test_referenceInstanceMethod_fromInitializer() throws Exception {
|
| + resolveAndTest(
|
| + Joiner.on("\n").join(
|
| + "// filler filler filler filler filler filler filler filler filler filler",
|
| + "class Object {}",
|
| + "class A {",
|
| + " var x;",
|
| + " A() : x = foo {}",
|
| + " foo() {}",
|
| + "}",
|
| + ""),
|
| + errEx(ResolverErrorCode.INSTANCE_METHOD_FROM_INITIALIZER, 5, 13, 3));
|
| + }
|
| +
|
| public void testRedirectConstructor() {
|
| resolveAndTest(Joiner.on("\n").join(
|
| "class Object {}",
|
|
|