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

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

Issue 32693003: Fix issue 13575 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: second attempt 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/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 44d5f0d042209e94de1a3d57d4cb6ae060a79171..6796729ba7cfd16bd50268f6d6982f207160c2bd 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
@@ -3078,6 +3078,44 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_referencedBeforeDeclaration_hideInBlock_function() throws Exception {
+ Source source = addSource(createSource(//
+ "var v = 1;",
+ "main() {",
+ " print(v);",
+ " v() {}",
+ "}",
+ "print(x) {}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION);
+ }
+
+ public void test_referencedBeforeDeclaration_hideInBlock_local() throws Exception {
+ Source source = addSource(createSource(//
+ "var v = 1;",
+ "main() {",
+ " print(v);",
+ " var v = 2;",
+ "}",
+ "print(x) {}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION);
+ }
+
+ public void test_referencedBeforeDeclaration_hideInBlock_subBlock() throws Exception {
+ Source source = addSource(createSource(//
+ "var v = 1;",
+ "main() {",
+ " {",
+ " print(v);",
+ " }",
+ " var v = 2;",
+ "}",
+ "print(x) {}"));
+ resolve(source);
+ assertErrors(source, CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION);
+ }
+
public void test_referenceToDeclaredVariableInInitializer_closure() throws Exception {
Source source = addSource(createSource(//
"f() {",

Powered by Google App Engine
This is Rietveld 408576698