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

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

Issue 62843003: Issue 14766. It is still compile-time error to reference variable from its initializer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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/CompileTimeErrorCodeTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
index b7c62497c13ef959e208de1021448453a433e949..465a9e1b78d1a33e04020b3e04c1112a4dd6a332 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
@@ -3158,6 +3158,24 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
assertErrors(source, CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION);
}
+ public void test_referencedBeforeDeclaration_inInitializer_closure() throws Exception {
+ Source source = addSource(createSource(//
+ "main() {",
+ " var v = () => v;",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION);
+ }
+
+ public void test_referencedBeforeDeclaration_inInitializer_directly() throws Exception {
+ Source source = addSource(createSource(//
+ "main() {",
+ " var v = v;",
+ "}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION);
+ }
+
public void test_rethrowOutsideCatch() throws Exception {
Source source = addSource(createSource(//
"f() {",

Powered by Google App Engine
This is Rietveld 408576698