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

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

Issue 21513005: Report ASSIGNMENT_TO_CONST. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 a7c3fa5ef40382c0d9c4b32aa8c43ac35f306786..51e82754187ecfc287b3117bf960ae3b1948eae5 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
@@ -409,6 +409,32 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_assignmentToConst_instanceVariable() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " static const v = 0;",
+ "}",
+ "f() {",
+ " A a = new A();",
+ " a.v = 1;",
+ "}"));
+ resolve(source);
+ assertErrors(StaticWarningCode.ASSIGNMENT_TO_CONST);
+ verify(source);
+ }
+
+ // TODO(scheglov)
jwren 2013/08/01 16:57:54 TODO?
+ public void test_assignmentToConst_localVariable() throws Exception {
+ Source source = addSource(createSource(//
+ "f() {",
+ " const x = 0;",
+ " x = 1;",
+ "}"));
+ resolve(source);
+ assertErrors(StaticWarningCode.ASSIGNMENT_TO_CONST);
+ verify(source);
+ }
+
public void test_assignmentToFinal_instanceVariable() throws Exception {
Source source = addSource(createSource(//
"class A {",

Powered by Google App Engine
This is Rietveld 408576698