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

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

Issue 22846005: Report StaticWarningCode.UNDEFINED_IDENTIFIER when name is hidden, but not defined yet in block. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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/StaticWarningCodeTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticWarningCodeTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticWarningCodeTest.java
index bc82276aa77f4bffefbba63c0bc98ffd28e0cffe..0c664b468959ab9f3d179b55a5ae0022dff1e93c 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticWarningCodeTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticWarningCodeTest.java
@@ -2086,6 +2086,44 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_undefinedIdentifier_hideInBlock_function() throws Exception {
+ Source source = addSource(createSource(//
+ "var v = 1;",
+ "main() {",
+ " print(v);",
+ " v() {}",
+ "}",
+ "print(x) {}"));
+ resolve(source);
+ assertErrors(StaticWarningCode.UNDEFINED_IDENTIFIER);
+ }
+
+ public void test_undefinedIdentifier_hideInBlock_local() throws Exception {
+ Source source = addSource(createSource(//
+ "var v = 1;",
+ "main() {",
+ " print(v);",
+ " var v = 2;",
+ "}",
+ "print(x) {}"));
+ resolve(source);
+ assertErrors(StaticWarningCode.UNDEFINED_IDENTIFIER);
+ }
+
+ public void test_undefinedIdentifier_hideInBlock_subBlock() throws Exception {
+ Source source = addSource(createSource(//
+ "var v = 1;",
+ "main() {",
+ " {",
+ " print(v);",
+ " }",
+ " var v = 2;",
+ "}",
+ "print(x) {}"));
+ resolve(source);
+ assertErrors(StaticWarningCode.UNDEFINED_IDENTIFIER);
+ }
+
public void test_undefinedIdentifier_initializer() throws Exception {
Source source = addSource(createSource(//
"var a = b;"));

Powered by Google App Engine
This is Rietveld 408576698